Problem shutting down with >1 dialog open

Leo Shaw leoshaw at orange.net
Mon Nov 5 05:27:14 PST 2007


Leo Shaw wrote:
> WX      : 2.8.4
> OS      : Windows XP
> COMPILER: VC++ 2005 (IDE)
> 
> Hi, my app is a plugin for Novell's GroupWise Client, so it's built as a 
> DLL roughly following the guidelines at 
> http://www.wxwidgets.org/wiki/index.php/Creating_A_DLL_Of_An_Application
> 
> It works nicely, but I have a problem when my app has more than one 
> dialog open, and the user closes the GroupWise Client.  For instance, if 
> I have two dialogs open, the top one (most recently opened one) closes, 
> but the first one remains visible and doesn't respond to mouse clicks or 
> key presses (it seems that its event loop is still running).
> 
> I have tried several things, including looping over wxTopLevelWindows 
> and calling Close on each one, and looping over wxTopLevelWindows and doing
> 
> wxCloseEvent event(wxEVT_CLOSE_WINDOW, (*it)->GetId());
> event.SetCanVeto(false);
> (*it)->GetEventHandler()->AddPendingEvent(event);
> 
> on each one.  In both cases, the problem arises when Exit is called on 
> the lowest window's event loop:
> 
> wxCHECK_RET( IsRunning(), _T("can't call Exit() if not running") );
> 
> fails, because it seems the event is handled before the window's event 
> loop has been resumed.  As a result, the lowest window's event loop 
> never terminates.

Another observation: I've added a thread that's launched when GW shuts 
down, which repeatedly waits a bit then calls Close on any top-level 
windows that are still in wxTopLevelWindows.  The app still doesn't exit of 
its own accord, but strangely when I pause the program (Break all threads), 
then resume, it does exit.. help!





More information about the wx-users mailing list