From 281d7531a3d92036380b27e2dabda162e7289f87 Mon Sep 17 00:00:00 2001 From: skidau Date: Mon, 19 Mar 2012 21:51:26 +1100 Subject: [PATCH] Fixed a crash on exit by calling DefWindowProc after the WM_DESTORY message has been received. Patch by eddie.willett. Fixes issue 4588. Fixes issue 5285. --- Externals/wxWidgets/include/wx/msw/window.h | 2 +- Externals/wxWidgets/src/msw/window.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Externals/wxWidgets/include/wx/msw/window.h b/Externals/wxWidgets/include/wx/msw/window.h index c75ac55d33..b037268bd6 100644 --- a/Externals/wxWidgets/include/wx/msw/window.h +++ b/Externals/wxWidgets/include/wx/msw/window.h @@ -365,7 +365,7 @@ public: virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); // Calls an appropriate default window procedure - virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); + virtual WXLRESULT MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam, bool callDefWindowProc = false); // message processing helpers diff --git a/Externals/wxWidgets/src/msw/window.cpp b/Externals/wxWidgets/src/msw/window.cpp index 4810bd68d7..00e68b2d2d 100644 --- a/Externals/wxWidgets/src/msw/window.cpp +++ b/Externals/wxWidgets/src/msw/window.cpp @@ -2234,9 +2234,9 @@ bool wxWindowMSW::DoPopupMenu(wxMenu *menu, int x, int y) // pre/post message processing // =========================================================================== -WXLRESULT wxWindowMSW::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) +WXLRESULT wxWindowMSW::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam, bool callDefWindowProc /* = false */) { - if ( m_oldWndProc ) + if (!callDefWindowProc && m_oldWndProc) return ::CallWindowProc(CASTWNDPROC m_oldWndProc, GetHwnd(), (UINT) nMsg, (WPARAM) wParam, (LPARAM) lParam); else return ::DefWindowProc(GetHwnd(), nMsg, wParam, lParam); @@ -2653,11 +2653,12 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l break; case WM_DESTROY: - // never set processed to true and *always* pass WM_DESTROY to - // DefWindowProc() as Windows may do some internal cleanup when - // processing it and failing to pass the message along may cause - // memory and resource leaks! + // *always* pass WM_DESTROY to DefWindowProc() as Windows may do + // some internal cleanup when processing it and failing to pass + // the message along may cause memory and resource leaks! (void)HandleDestroy(); + rc.result = MSWDefWindowProc(message, wParam, lParam, true); + processed = true; break; case WM_SIZE: