[WIN32K]
authorRafal Harabien <rafalh@reactos.org>
Sun, 1 May 2011 13:15:30 +0000 (13:15 +0000)
committerRafal Harabien <rafalh@reactos.org>
Sun, 1 May 2011 13:15:30 +0000 (13:15 +0000)
* Do not reference current thread before sending message to it. It was causing thread to be a ghost if ExitThread was called in WndProc.
* Hold only UserRefObjectCo reference on windows when sending messages to them.

svn path=/trunk/; revision=51527

reactos/subsystems/win32/win32k/ntuser/message.c
reactos/subsystems/win32/win32k/ntuser/window.c

index b242237..9067b26 100644 (file)
@@ -1218,7 +1218,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
             RETURN( FALSE);
         }
 
-        ObReferenceObject(Win32Thread->pEThread);
+        //ObReferenceObject(Win32Thread->pEThread);
         Result = (ULONG_PTR)co_IntCallWindowProc( Window->lpfnWndProc,
                                                   !Window->Unicode,
                                                   hWnd,
@@ -1231,7 +1231,7 @@ co_IntSendMessageTimeoutSingle( HWND hWnd,
             *uResult = Result;
         }
 
-        ObDereferenceObject(Win32Thread->pEThread);
+        //ObDereferenceObject(Win32Thread->pEThread);
 
         IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult);
 
@@ -1438,7 +1438,7 @@ co_IntSendMessageWithCallBack( HWND hWnd,
 
         IntCallWndProc( Window, hWnd, Msg, wParam, lParam);
 
-        ObReferenceObject(Win32Thread->pEThread);
+        //ObReferenceObject(Win32Thread->pEThread);
         Result = (ULONG_PTR)co_IntCallWindowProc( Window->lpfnWndProc,
                                                   !Window->Unicode,
                                                   hWnd,
@@ -1450,7 +1450,7 @@ co_IntSendMessageWithCallBack( HWND hWnd,
         {
             *uResult = Result;
         }
-        ObDereferenceObject(Win32Thread->pEThread);
+        //ObDereferenceObject(Win32Thread->pEThread);
 
         IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, (LRESULT *)uResult);
 
index 11ea466..6fe58a5 100644 (file)
@@ -1995,6 +1995,7 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
    hwndInsertAfter = HWND_TOP;
 
    UserRefObjectCo(Window, &Ref);
+   UserDereferenceObject(Window);
    ObDereferenceObject(WinSta);
 
    //// Check for a hook to eliminate overhead. ////
@@ -2260,7 +2261,6 @@ cleanup:
    if (Window)
    {
       UserDerefObjectCo(Window);
-      UserDereferenceObject(Window);
    }
    if (ParentWindow) UserDerefObjectCo(ParentWindow);