Author: jimtabor
Date: Thu Jul 10 06:27:53 2008
New Revision: 34408
URL:
http://svn.reactos.org/svn/reactos?rev=34408&view=rev
Log:
- Needed to reference the previous window handle. This prevents the window object from
becoming zero during it's own demise when posting send messages.
- See bug 3490.
Modified:
trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/nt…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Thu Jul 10 06:27:53
2008
@@ -60,13 +60,16 @@
VOID FASTCALL
co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
{
- USER_REFERENCE_ENTRY Ref;
- PWINDOW_OBJECT Window;
+ USER_REFERENCE_ENTRY Ref, RefPrev;
+ PWINDOW_OBJECT Window, WindowPrev = NULL;
if ((Window = UserGetWindowObject(hWnd)))
- {
-
+ {
UserRefObjectCo(Window, &Ref);
+
+ WindowPrev = UserGetWindowObject(hWndPrev);
+
+ if (WindowPrev) UserRefObjectCo(WindowPrev, &RefPrev);
/* Send palette messages */
if (co_IntPostOrSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0))
@@ -91,11 +94,11 @@
Window->Wnd->Owner->hWndLastActive = hWnd;
}
- if (Window && hWndPrev)
+ if (Window && WindowPrev)
{
PWINDOW_OBJECT cWindow;
HWND *List, *phWnd;
- HANDLE OldTID = IntGetWndThreadId(UserGetWindowObject(hWndPrev));
+ HANDLE OldTID = IntGetWndThreadId(WindowPrev);
HANDLE NewTID = IntGetWndThreadId(Window);
DPRINT("SendActiveMessage Old -> %x, New -> %x\n", OldTID, NewTID);
@@ -126,6 +129,7 @@
ExFreePool(List);
}
}
+ UserDerefObjectCo(WindowPrev); // Now allow the previous window to die.
}
UserDerefObjectCo(Window);