Alexandre Julliard : user32: Avoid accessing the dialog info of a destroyed window.

Alexandre Julliard julliard at winehq.org
Wed Apr 6 11:36:37 CDT 2011


Module: wine
Branch: master
Commit: ad32b28ac038e56c8e3940926aeb0d172e2bebe8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ad32b28ac038e56c8e3940926aeb0d172e2bebe8

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Apr  6 12:35:01 2011 +0200

user32: Avoid accessing the dialog info of a destroyed window.

---

 dlls/user32/dialog.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index b7b3cce..2aa89d9 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -691,7 +691,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCVOID dlgTemplate,
         if (dlgProc)
         {
             HWND focus = GetNextDlgTabItem( hwnd, 0, FALSE );
-            if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)focus, param ) &&
+            if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)focus, param ) && IsWindow( hwnd ) &&
                 ((~template.style & DS_CONTROL) || (template.style & WS_VISIBLE)))
             {
                 /* By returning TRUE, app has requested a default focus assignment.
@@ -811,15 +811,16 @@ INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
             if (msg.message == WM_QUIT)
             {
                 PostQuitMessage( msg.wParam );
-                dlgInfo->flags |= DF_END;
+                if (!IsWindow( hwnd )) return 0;
+                break;
             }
-
             if (!IsWindow( hwnd )) return 0;
             if (!(dlgInfo->flags & DF_END) && !IsDialogMessageW( hwnd, &msg))
             {
                 TranslateMessage( &msg );
                 DispatchMessageW( &msg );
             }
+            if (!IsWindow( hwnd )) return 0;
             if (dlgInfo->flags & DF_END) break;
 
             if (bFirstEmpty && msg.message == WM_TIMER)




More information about the wine-cvs mailing list