wxMax - Aui, SetManagedWindow crashing.

BlitzMax Forums/Brucey's Modules/wxMax - Aui, SetManagedWindow crashing.

kenshin(Posted 2009) [#1]
Load up the Aui sample and change this:
' tell wxAuiManager to manage this frame
manager = New wxAuiManager.Create(Self)

to this:
' tell wxAuiManager to manage this frame
manager = New wxAuiManager.Create(Self)
manager.SetManagedWindow( Self ) 

and run.

I get an unhandled exception on that new line, but I'm not sure why.
Any ideas?


Brucey(Posted 2009) [#2]
The problem (at least after testing on Mac), appears to be some kind of recursive event processing.
eg:
Thread 0 Crashed:
0   aui.debug                     	0x002b98a9 wxEvtHandler::ProcessEvent(wxEvent&) + 9
1   aui.debug                     	0x002b990c wxEvtHandler::ProcessEvent(wxEvent&) + 108
2   aui.debug                     	0x002b990c wxEvtHandler::ProcessEvent(wxEvent&) + 108
3   aui.debug                     	0x002b990c wxEvtHandler::ProcessEvent(wxEvent&) + 108
4   aui.debug                     	0x002b990c wxEvtHandler::ProcessEvent(wxEvent&) + 108
5   aui.debug                     	0x002b990c wxEvtHandler::ProcessEvent(wxEvent&) + 108
6   aui.debug                     	0x002b990c wxEvtHandler::ProcessEvent(wxEvent&) + 108
7   aui.debug                     	0x002b990c wxEvtHandler::ProcessEvent(wxEvent&) + 108
8   aui.debug                     	0x002b990c wxEvtHandler::ProcessEvent(wxEvent&) + 108
...
... and so on until the stack is full


If you pass nothing into the Create() method, and then call SetManagedWindow(Self), it works okay.
I'm guessing that it doesn't like the fact that you are setting the managed window to the window you already set during the create. Perhaps it uses a stack where the original window receives events from the new managed window (or vice versa)... which in your case would cause it to call ProcessEvent on Self, which in turn would call ProcessEvent on Self.... etc...


Space_guy(Posted 2009) [#3]
Welcome back brucey! :)


kenshin(Posted 2009) [#4]
Okay, thanks for the info Brucey. I didn't think about that possibility, but now that you say it seems obvious. I just came across the crash during some testing.

Soon I'll be using the command in my editor, so I'll post further if there is a problem using it there.

Thx again;)