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:
LoRd_MuldeR 2011-12-27 05:47:38 +01:00
parent 17d1582186
commit d5a4aa72e3
2 changed files with 6 additions and 2 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 4 #define VER_LAMEXP_MINOR_LO 4
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 12 #define VER_LAMEXP_PATCH 12
#define VER_LAMEXP_BUILD 851 #define VER_LAMEXP_BUILD 852
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tool versions (minimum expected versions!) // Tool versions (minimum expected versions!)

View File

@ -808,7 +808,7 @@ static bool lamexp_event_filter(void *message, long *result)
{ {
app->closeAllWindows(); app->closeAllWindows();
app->processEvents(); app->processEvents();
Sleep(0); Sleep(8);
} }
} }
} }
@ -818,9 +818,13 @@ static bool lamexp_event_filter(void *message, long *result)
qWarning("WM_ENDSESSION message received!"); qWarning("WM_ENDSESSION message received!");
if(reinterpret_cast<MSG*>(message)->wParam == TRUE) if(reinterpret_cast<MSG*>(message)->wParam == TRUE)
{ {
g_sessionIsEnding = true;
if(QApplication *app = reinterpret_cast<QApplication*>(QApplication::instance())) if(QApplication *app = reinterpret_cast<QApplication*>(QApplication::instance()))
{ {
app->quit(); app->quit();
app->processEvents();
lamexp_finalization();
exit(1);
} }
} }
*result = 0; *result = 0;