[NTUSER] Fix co_IntSetParent when calling on itself (#6365)

* Patch by @I_Kill_Bugs.

* Provide explanation for change.
CORE-9386
This commit is contained in:
Doug Lyons 2024-05-02 03:43:41 -05:00 committed by GitHub
parent db93cb1709
commit 515f998f0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1218,29 +1218,29 @@ co_IntSetParent(PWND Wnd, PWND WndNewParent)
if (WndOldParent) UserReferenceObject(WndOldParent); /* Caller must deref */
if (WndNewParent != WndOldParent)
/* Even if WndNewParent == WndOldParent continue because the
* child window (Wnd) should be moved to the top of the z-order */
/* Unlink the window from the siblings list */
IntUnlinkWindow(Wnd);
Wnd->ExStyle2 &= ~WS_EX2_LINKED;
/* Set the new parent */
WndSetParent(Wnd, WndNewParent);
if (Wnd->style & WS_CHILD &&
Wnd->spwndOwner &&
Wnd->spwndOwner->ExStyle & WS_EX_TOPMOST)
{
/* Unlink the window from the siblings list */
IntUnlinkWindow(Wnd);
Wnd->ExStyle2 &= ~WS_EX2_LINKED;
/* Set the new parent */
WndSetParent(Wnd, WndNewParent);
if ( Wnd->style & WS_CHILD &&
Wnd->spwndOwner &&
Wnd->spwndOwner->ExStyle & WS_EX_TOPMOST )
{
ERR("SetParent Top Most from Pop up!\n");
Wnd->ExStyle |= WS_EX_TOPMOST;
}
/* Link the window with its new siblings */
IntLinkHwnd( Wnd,
((0 == (Wnd->ExStyle & WS_EX_TOPMOST) &&
UserIsDesktopWindow(WndNewParent) ) ? HWND_TOP : HWND_TOPMOST ) );
ERR("SetParent Top Most from Pop up\n");
Wnd->ExStyle |= WS_EX_TOPMOST;
}
/* Link the window with its new siblings */
IntLinkHwnd(Wnd,
((0 == (Wnd->ExStyle & WS_EX_TOPMOST) &&
UserIsDesktopWindow(WndNewParent)) ? HWND_TOP : HWND_TOPMOST));
if ( WndNewParent == co_GetDesktopWindow(Wnd) &&
!(Wnd->style & WS_CLIPSIBLINGS) )
{