Windows will kill our process immediately after we return from handling the WM_ENDSESSION message, so we have to clean-up explicitly *before* returning from the message handler. Not nice, but there is no other way. Also, as Windows will kill our process anyway and thus prevent a proper application shutdown, we can just call exit() from the message handler. This makes sure nothing "unexpected" can happen in the short moment that our application would continue to run after returning from the message handler.
This commit is contained in:
parent
17d1582186
commit
d5a4aa72e3
@ -30,7 +30,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 4
|
||||
#define VER_LAMEXP_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 12
|
||||
#define VER_LAMEXP_BUILD 851
|
||||
#define VER_LAMEXP_BUILD 852
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Tool versions (minimum expected versions!)
|
||||
|
@ -808,7 +808,7 @@ static bool lamexp_event_filter(void *message, long *result)
|
||||
{
|
||||
app->closeAllWindows();
|
||||
app->processEvents();
|
||||
Sleep(0);
|
||||
Sleep(8);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -818,9 +818,13 @@ static bool lamexp_event_filter(void *message, long *result)
|
||||
qWarning("WM_ENDSESSION message received!");
|
||||
if(reinterpret_cast<MSG*>(message)->wParam == TRUE)
|
||||
{
|
||||
g_sessionIsEnding = true;
|
||||
if(QApplication *app = reinterpret_cast<QApplication*>(QApplication::instance()))
|
||||
{
|
||||
app->quit();
|
||||
app->processEvents();
|
||||
lamexp_finalization();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
*result = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user