[2/2] user32: When destroying a window, preserve the first WM_QUIT message that was posted to it.

Francois Gouget fgouget at codeweavers.com
Fri Aug 5 13:29:52 CDT 2011


---

This may not be the right fix but at least it makes my test pass :-)
I have a feeling the answer is going to be that this needs more tests 
though :-( If so let me know what to test.


 dlls/user32/tests/msg.c |    2 +-
 server/queue.c          |   10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 872ff21..4af6129 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -10241,7 +10241,7 @@ static void test_quit_message(void)
         add_message(&rmsg);
         DispatchMessage(&msg);
     }
-    ok_sequence(WmStopQuitSeq, "WmStopQuitSeq", TRUE);
+    ok_sequence(WmStopQuitSeq, "WmStopQuitSeq", FALSE);
 }
 
 static const struct message WmMouseHoverSeq[] = {
diff --git a/server/queue.c b/server/queue.c
index 03b0e92..3fa546e 100644
--- a/server/queue.c
+++ b/server/queue.c
@@ -1918,7 +1918,15 @@ void queue_cleanup_window( struct thread *thread, user_handle_t win )
         LIST_FOR_EACH_SAFE( ptr, next, &queue->msg_list[i] )
         {
             struct message *msg = LIST_ENTRY( ptr, struct message, entry );
-            if (msg->win == win) remove_queue_message( queue, msg, i );
+            if (msg->win == win)
+            {
+                if (msg->msg == WM_QUIT && !queue->quit_message)
+                {
+                    queue->quit_message = 1;
+                    queue->exit_code = msg->wparam;
+                }
+                remove_queue_message( queue, msg, i );
+            }
         }
     }
 
-- 
1.7.5.4



More information about the wine-patches mailing list