https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e286c4c5202ac2d6e7909…
commit e286c4c5202ac2d6e7909ee05cdc95f76b8f4897
Author:     Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sat Sep 1 23:42:11 2018 +0200
Commit:     Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sat Sep 1 23:46:20 2018 +0200
    [WIN32K:NTUSER] Optimize IntWinListOwnedPopups() a little bit. Improve a trace.
---
 win32ss/user/ntuser/window.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c
index 40a7459dd2..4776b8e9d3 100644
--- a/win32ss/user/ntuser/window.c
+++ b/win32ss/user/ntuser/window.c
@@ -288,16 +288,19 @@ IntWinListOwnedPopups(PWND Window)
 {
     PWND Child, Desktop;
     HWND *List;
-    UINT Index, NumChildren = 0;
+    UINT Index, NumOwned = 0;
     Desktop = co_GetDesktopWindow(Window);
     if (!Desktop)
         return NULL;
     for (Child = Desktop->spwndChild; Child; Child = Child->spwndNext)
-        ++NumChildren;
+    {
+        if (Child->spwndOwner == Window)
+            ++NumOwned;
+    }
-    List = ExAllocatePoolWithTag(PagedPool, (NumChildren + 1) * sizeof(HWND),
USERTAG_WINDOWLIST);
+    List = ExAllocatePoolWithTag(PagedPool, (NumOwned + 1) * sizeof(HWND),
USERTAG_WINDOWLIST);
     if (!List)
     {
         ERR("Failed to allocate memory for children array\n");
@@ -2626,7 +2629,7 @@ BOOLEAN co_UserDestroyWindow(PVOID Object)
    hWnd = Window->head.h;
    ti = PsGetCurrentThreadWin32Thread();
-   TRACE("co_UserDestroyWindow \n");
+   TRACE("co_UserDestroyWindow(Window = 0x%p, hWnd = 0x%p)\n", Window, hWnd);
    /* Check for owner thread */
    if ( Window->head.pti != PsGetCurrentThreadWin32Thread())