diff --git a/reactos/win32ss/user/ntuser/window.c b/reactos/win32ss/user/ntuser/window.c index 1e62dc6f82b..87c1a892fc0 100644 --- a/reactos/win32ss/user/ntuser/window.c +++ b/reactos/win32ss/user/ntuser/window.c @@ -2594,7 +2594,8 @@ BOOLEAN co_UserDestroyWindow(PVOID Object) */ if (!co_WinPosShowWindow(Window, SW_HIDE)) { // Rule #1. - if (ti->MessageQueue->spwndActive == Window && ti->MessageQueue == IntGetFocusMessageQueue()) + if ( ti->MessageQueue->spwndActive == Window || + (ti->MessageQueue->spwndActive == NULL && ti->MessageQueue == IntGetFocusMessageQueue()) ) { co_WinPosActivateOtherWindow(Window); } diff --git a/reactos/win32ss/user/ntuser/winpos.c b/reactos/win32ss/user/ntuser/winpos.c index 942c8338583..a436f5db688 100644 --- a/reactos/win32ss/user/ntuser/winpos.c +++ b/reactos/win32ss/user/ntuser/winpos.c @@ -349,11 +349,16 @@ co_WinPosActivateOtherWindow(PWND Wnd) { WndTo = Wnd->head.pti->MessageQueue->spwndActivePrev; if (can_activate_window( WndTo )) goto done; + } - // Find any window to bring to top. Works Okay for wine. + // Find any window to bring to top. Works Okay for wine since it does not see X11 windows. WndTo = UserGetDesktopWindow(); WndTo = WndTo->spwndChild; + if ( WndTo == NULL ) + { + return; + } for (;;) { if (WndTo == Wnd)