[CMAKE]
[reactos.git] / subsystems / win32 / win32k / ntuser / window.c
index d11c0df..fe36217 100644 (file)
@@ -448,6 +448,8 @@ static LRESULT co_UserFreeWindow(PWND Window,
    /* flush the message queue */
    MsqRemoveWindowMessagesFromQueue(Window);
 
+   IntDereferenceMessageQueue(Window->head.pti->MessageQueue);
+
    /* from now on no messages can be sent to this window anymore */
    Window->state |= WNDS_DESTROYED;
    Window->fnid |= FNID_FREED;
@@ -2508,8 +2510,6 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWND Window)
       }
    }
 
-   IntDereferenceMessageQueue(Window->head.pti->MessageQueue);
-
    IntEngWindowChanged(Window, WOC_DELETE);
 
    if (!IntIsWindow(Window->head.h))