mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 10:41:26 +00:00
[WIN32K:NTUSER] co_UserDestroyWindow(): Simplify the destruction of the owned windows.
This commit is contained in:
parent
e286c4c520
commit
4d48b88bfb
1 changed files with 31 additions and 48 deletions
|
@ -2741,55 +2741,38 @@ BOOLEAN co_UserDestroyWindow(PVOID Object)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recursively destroy owned windows */
|
/* Recursively destroy owned windows */
|
||||||
|
if (!(Window->style & WS_CHILD))
|
||||||
|
{
|
||||||
|
HWND* List;
|
||||||
|
HWND* phWnd;
|
||||||
|
PWND pWnd;
|
||||||
|
|
||||||
if (! (Window->style & WS_CHILD))
|
List = IntWinListOwnedPopups(Window);
|
||||||
|
if (List)
|
||||||
{
|
{
|
||||||
for (;;)
|
for (phWnd = List; *phWnd; ++phWnd)
|
||||||
{
|
{
|
||||||
BOOL GotOne = FALSE;
|
pWnd = ValidateHwndNoErr(*phWnd);
|
||||||
HWND *Children;
|
if (pWnd == NULL)
|
||||||
HWND *ChildHandle;
|
|
||||||
PWND Child, Desktop;
|
|
||||||
|
|
||||||
Desktop = IntIsDesktopWindow(Window) ? Window :
|
|
||||||
UserGetWindowObject(IntGetDesktopWindow());
|
|
||||||
Children = IntWinListChildren(Desktop);
|
|
||||||
|
|
||||||
if (Children)
|
|
||||||
{
|
|
||||||
for (ChildHandle = Children; *ChildHandle; ++ChildHandle)
|
|
||||||
{
|
|
||||||
Child = UserGetWindowObject(*ChildHandle);
|
|
||||||
if (Child == NULL)
|
|
||||||
continue;
|
continue;
|
||||||
if (Child->spwndOwner != Window)
|
ASSERT(pWnd->spwndOwner == Window);
|
||||||
|
ASSERT(pWnd != Window);
|
||||||
|
|
||||||
|
pWnd->spwndOwner = NULL;
|
||||||
|
if (IntWndBelongsToThread(pWnd, PsGetCurrentThreadWin32Thread()))
|
||||||
{
|
{
|
||||||
continue;
|
USER_REFERENCE_ENTRY Ref;
|
||||||
|
UserRefObjectCo(pWnd, &Ref); // Temp HACK?
|
||||||
|
co_UserDestroyWindow(pWnd);
|
||||||
|
UserDerefObjectCo(pWnd); // Temp HACK?
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ERR("IntWndBelongsToThread(0x%p) is FALSE, ignoring.\n", pWnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IntWndBelongsToThread(Child, PsGetCurrentThreadWin32Thread()))
|
ExFreePoolWithTag(List, USERTAG_WINDOWLIST);
|
||||||
{
|
|
||||||
USER_REFERENCE_ENTRY ChildRef;
|
|
||||||
UserRefObjectCo(Child, &ChildRef); // Temp HACK?
|
|
||||||
co_UserDestroyWindow(Child);
|
|
||||||
UserDerefObjectCo(Child); // Temp HACK?
|
|
||||||
|
|
||||||
GotOne = TRUE;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Child->spwndOwner != NULL)
|
|
||||||
{
|
|
||||||
Child->spwndOwner = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
ExFreePoolWithTag(Children, USERTAG_WINDOWLIST);
|
|
||||||
}
|
|
||||||
if (! GotOne)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue