Author: mjmartin
Date: Sat Apr  9 07:19:31 2011
New Revision: 51291

URL: http://svn.reactos.org/svn/reactos?rev=51291&view=rev
Log:
[Win32k]
- Only call hooks and check if Win32Thread is in cleanup if the windows 
procedure is being called.
- Set DispatchingListEntry.Flink to NULL. The real fix for bug 5580. This bug 
may be the cause of other crashes experienced by users just before loading 
desktop. Found by rafalh.

Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/message.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/message.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/message.c?rev=51291&r1=51290&r2=51291&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] 
(original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/message.c [iso-8859-1] Sat Apr 
 9 07:19:31 2011
@@ -1403,17 +1403,8 @@
 
     Win32Thread = PsGetCurrentThreadWin32Thread();
 
-    IntCallWndProc( Window, hWnd, Msg, wParam, lParam);
-
     if (Win32Thread == NULL)
     {
-        ASSERT(FALSE);
-        RETURN(FALSE);
-    }
-
-    if (Win32Thread->TIF_flags & TIF_INCLEANUP)
-    {
-        /* Never send messages to exiting threads */
         RETURN(FALSE);
     }
 
@@ -1437,6 +1428,15 @@
     /* If this is not a callback and it can be sent now, then send it. */
     if ((Window->head.pti->MessageQueue == Win32Thread->MessageQueue) && 
(CompletionCallback == NULL))
     {
+        if (Win32Thread->TIF_flags & TIF_INCLEANUP)
+        {
+            UnpackParam(lParamPacked, Msg, wParam, lParam, FALSE);
+            /* Never send messages to exiting threads */
+            RETURN(FALSE);
+        }
+
+        IntCallWndProc( Window, hWnd, Msg, wParam, lParam);
+
         ObReferenceObject(Win32Thread->pEThread);
         Result = (ULONG_PTR)co_IntCallWindowProc( Window->lpfnWndProc,
                                                   !Window->Unicode,
@@ -1450,9 +1450,11 @@
             *uResult = Result;
         }
         ObDereferenceObject(Win32Thread->pEThread);
-    }
-
-    IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult);
+
+        IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT 
*)uResult);
+    }
+
+
 
     if ((Window->head.pti->MessageQueue == Win32Thread->MessageQueue) && 
(CompletionCallback == NULL))
     {
@@ -1479,7 +1481,8 @@
     Message->QS_Flags = 0;
     Message->SenderQueue = NULL; // mjmartin, you are right! This is null.
     Message->CallBackSenderQueue = Win32Thread->MessageQueue;
-
+    Message->DispatchingListEntry.Flink = NULL;
+    
     IntReferenceMessageQueue(Window->head.pti->MessageQueue);
     Message->CompletionCallback = CompletionCallback;
     Message->CompletionCallbackContext = CompletionCallbackContext;


Reply via email to