[PATCH] user32: Protect DefMDIChildProcA/W from invalid window handles.
Dmitry Timoshkov
dmitry at codeweavers.com
Wed Jun 24 07:38:48 CDT 2009
This patch fixes intermittent crashes in a multithreaded MDI application
I'm working on.
---
dlls/user32/mdi.c | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c
index 7e017b0..7904123 100644
--- a/dlls/user32/mdi.c
+++ b/dlls/user32/mdi.c
@@ -1441,12 +1441,18 @@ LRESULT WINAPI DefFrameProcW( HWND hwnd, HWND hwndMDIClient,
LRESULT WINAPI DefMDIChildProcA( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam )
{
- HWND client = GetParent(hwnd);
- MDICLIENTINFO *ci = get_client_info( client );
+ HWND client;
+ MDICLIENTINFO *ci;
+
+ if (!IsWindow( hwnd )) return 0;
TRACE("%p %04x (%s) %08lx %08lx\n", hwnd, message, SPY_GetMsgName(message, hwnd), wParam, lParam);
hwnd = WIN_GetFullHandle( hwnd );
+
+ client = GetParent( hwnd );
+ ci = get_client_info( client );
+
if (!ci) return DefWindowProcA( hwnd, message, wParam, lParam );
switch (message)
@@ -1481,12 +1487,18 @@ LRESULT WINAPI DefMDIChildProcA( HWND hwnd, UINT message,
LRESULT WINAPI DefMDIChildProcW( HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam )
{
- HWND client = GetParent(hwnd);
- MDICLIENTINFO *ci = get_client_info( client );
+ HWND client;
+ MDICLIENTINFO *ci;
+
+ if (!IsWindow( hwnd )) return 0;
TRACE("%p %04x (%s) %08lx %08lx\n", hwnd, message, SPY_GetMsgName(message, hwnd), wParam, lParam);
hwnd = WIN_GetFullHandle( hwnd );
+
+ client = GetParent( hwnd );
+ ci = get_client_info( client );
+
if (!ci) return DefWindowProcW( hwnd, message, wParam, lParam );
switch (message)
--
1.6.2.4
More information about the wine-patches
mailing list