[2/2] user32: DefDlgProc on WM_QUIT should repost it and terminate the dialog message loop.

Dmitry Timoshkov dmitry at codeweavers.com
Mon Apr 4 06:40:58 CDT 2011


This patch should fix the problem reported in the bug 1918.
---
 dlls/user32/dialog.c    |    6 ++++++
 dlls/user32/tests/msg.c |    6 +-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c
index 052fbff..7131ba6 100644
--- a/dlls/user32/dialog.c
+++ b/dlls/user32/dialog.c
@@ -808,6 +808,12 @@ INT DIALOG_DoDialogBox( HWND hwnd, HWND owner )
                 if (!GetMessageW( &msg, 0, 0, 0 )) break;
             }
 
+            if (msg.message == WM_QUIT)
+            {
+                PostQuitMessage( msg.wParam );
+                dlgInfo->flags |= DF_END;
+            }
+
             if (!IsWindow( hwnd )) return 0;
             if (!(dlgInfo->flags & DF_END) && !IsDialogMessageW( hwnd, &msg))
             {
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 65e417a..4be4c38 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -10124,19 +10124,15 @@ static void test_quit_message(void)
     flush_events();
     flush_sequence();
     ret = DialogBoxParam(GetModuleHandle(0), "TEST_EMPTY_DIALOG", 0, wm_quit_dlg_proc, 0);
-todo_wine
     ok(ret == 1, "expected 1, got %d\n", ret);
-    ok_sequence(WmQuitDialogSeq, "WmQuitDialogSeq", TRUE);
+    ok_sequence(WmQuitDialogSeq, "WmQuitDialogSeq", FALSE);
     memset(&msg, 0xab, sizeof(msg));
     ret = PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
-todo_wine
     ok(ret, "PeekMessage failed\n");
-if (ret) {
     ok(msg.message == WM_QUIT, "Received message 0x%04x instead of WM_QUIT\n", msg.message);
     ok(msg.wParam == 0x1234, "wParam was 0x%lx instead of 0x1234\n", msg.wParam);
     ok(msg.lParam == 0, "lParam was 0x%lx instead of 0\n", msg.lParam);
 }
-}
 
 static const struct message WmMouseHoverSeq[] = {
     { WM_MOUSEACTIVATE, sent|optional },  /* we can get those when moving the mouse in focus-follow-mouse mode under X11 */
-- 
1.7.4.3




More information about the wine-patches mailing list