From ad32b28ac038e56c8e3940926aeb0d172e2bebe8 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 6 Apr 2011 12:35:01 +0200 Subject: [PATCH] user32: Avoid accessing the dialog info of a destroyed window. --- dlls/user32/dialog.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index b7b3cceee6..2aa89d9af1 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)