[WIN32K]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 22 Sep 2012 23:14:16 +0000 (23:14 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 22 Sep 2012 23:14:16 +0000 (23:14 +0000)
Unmap the desktop heap in IntFreeDesktopHeap. Fixes leaking session space memory, when creating and deleting desktops.
I would revert the "hackfix" from r57348, but for me changing MiPteToAddress to MiAddressToPte looks more like a legit bug fix, rather than "increasing system view space to 36MB instead of 20MB". But I'm probably missing something. In that case, Alex, please revert your hack, it shouldn't be needed anymore.
CORE-6688 #resolve

svn path=/trunk/; revision=57367

reactos/win32ss/user/ntuser/desktop.c

index a2e32e9..7124593 100644 (file)
@@ -554,7 +554,7 @@ DesktopWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *lRe
    ULONG Value;
    //ERR("DesktopWindowProc\n");
 
-   *lResult = 0; 
+   *lResult = 0;
 
    switch (Msg)
    {
@@ -596,7 +596,7 @@ DesktopWindowProc(PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *lRe
       case WM_SYSCOLORCHANGE:
          co_UserRedrawWindow(Wnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE|RDW_ALLCHILDREN);
          return TRUE;
-   } 
+   }
    return FALSE; // Not processed so go with callback.
 }
 
@@ -813,6 +813,12 @@ BOOL IntDeRegisterShellHookWindow(HWND hWnd)
 static VOID
 IntFreeDesktopHeap(IN OUT PDESKTOP Desktop)
 {
+    if (Desktop->pheapDesktop != NULL)
+    {
+        MmUnmapViewInSessionSpace(Desktop->pheapDesktop);
+        Desktop->pheapDesktop = NULL;
+    }
+
     if (Desktop->hsectionDesktop != NULL)
     {
         ObDereferenceObject(Desktop->hsectionDesktop);