From: Vadim Zeitlin Date: Wed, 23 Apr 2008 21:50:11 +0000 (+0000) Subject: prevent all our windows from being destroyed in wxApp::OnEndSession(), otherwise... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8c6dcbd0685efd7f37b1db66781ee9cfaead0260 prevent all our windows from being destroyed in wxApp::OnEndSession(), otherwise we're still killed before the cleanup code finishes to run git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 95d953241c..84a2360214 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -599,8 +599,15 @@ void wxApp::WakeUpIdle() void wxApp::OnEndSession(wxCloseEvent& WXUNUSED(event)) { // Windows will terminate the process soon after we return from - // WM_ENDSESSION handler anyhow, so make sure we at least execute our - // cleanup code before + // WM_ENDSESSION handler or when we delete our last window, so make sure we + // at least execute our cleanup code before + + // prevent the window from being destroyed when the corresponding wxTLW is + // destroyed: this will result in a leak of a HWND, of course, but who + // cares when the process is being killed anyhow + if ( !wxTopLevelWindows.empty() ) + wxTopLevelWindows[0]->SetHWND(0); + const int rc = OnExit(); wxEntryCleanup();