diff --git a/win32ss/user/ntuser/focus.c b/win32ss/user/ntuser/focus.c index 7ecb9c88f73..6ebbe64428e 100644 --- a/win32ss/user/ntuser/focus.c +++ b/win32ss/user/ntuser/focus.c @@ -617,6 +617,7 @@ IntSendFocusMessages( PTHREADINFO pti, PWND pWnd) PWND pWndPrev; PUSER_MESSAGE_QUEUE ThreadQueue = pti->MessageQueue; // Queue can change... HWND hwndPrev; + USER_REFERENCE_ENTRY Ref; ThreadQueue->QF_flags &= ~QF_FOCUSNULLSINCEACTIVE; if (!pWnd && ThreadQueue->spwndActive) @@ -625,6 +626,10 @@ IntSendFocusMessages( PTHREADINFO pti, PWND pWnd) } pWndPrev = ThreadQueue->spwndFocus; + if (pWndPrev) + { + UserRefObjectCo(pWndPrev, &Ref); + } /* check if the specified window can be set in the input data of a given queue */ if (!pWnd || ThreadQueue == pWnd->head.pti->MessageQueue) @@ -667,6 +672,9 @@ IntSendFocusMessages( PTHREADINFO pti, PWND pWnd) } } } + + if (pWndPrev) + UserDerefObjectCo(pWndPrev); } BOOL FASTCALL