wxApp::OnExit() not called - why???
Victor C.
vc6vc6 at gmail.com
Wed Jan 23 19:56:53 PST 2008
Before adding the following code snippet to the my application's main
thread, OnExit() would be called upon an 'Exit' menu item selection:
do
{
SomeActivity();
HANDLE ahEvent[1] = { hExitLoop };
DWORD dw = MsgWaitForMultipleObjects(1, ahEvent, FALSE,
timeout, QS_SENDMESSAGE);
if (dw == WAIT_OBJECT_0)
{
wxLogMessage(_T("SomeActivity aborted."));
}
else if (dw == WAIT_TIMEOUT)
{
::wxSafeYield(); // perhaps needs special handling
wxLogMessage(_T("timeout."));
}
else
{
::wxSafeYield();
wxLogMessage(_T("message in queue."));
}
} while (true);
But now (with the above loop in place), OnExit() never gets called as
a result of selecting that 'Exit' menu item.
All other menu items continue responding as before, thus I am assuming
that I didn't "kill" the message queue by introducing the above loop.
I swear that the only change I introduced to my program that caused
OnExit to stop being called is the above.
Killing the program now is only possible through TaskManager.
What on earth could possibly target OnExit only??? In such context?
BTW, if I remove this code snippet from my program, OnExit is being
called as expected.
Any idea?
Thanks,
Victor
More information about the wx-users
mailing list