Author: dquintana
Date: Sat Oct 25 15:44:11 2014
New Revision: 64986

URL: http://svn.reactos.org/svn/reactos?rev=64986&view=rev
Log:
[EXPLORER-NEW]
* Fix HMENU leak.

[BROWSEUI]
* Work around for WM_SETICON not properly returning the old HICON.

[SHELL32]
* Fix HICON leak.
* Nitpick.

[WIN32K]
* Do not refcount the menus improperly.

Modified:
    branches/shell-experiments/base/shell/explorer-new/traywnd.c
    branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
    branches/shell-experiments/dll/win32/shell32/newmenu.cpp
    branches/shell-experiments/dll/win32/shell32/shlview.cpp
    branches/shell-experiments/win32ss/user/ntuser/menu.c

Modified: branches/shell-experiments/base/shell/explorer-new/traywnd.c
URL: 
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/explorer-new/traywnd.c?rev=64986&r1=64985&r2=64986&view=diff
==============================================================================
--- branches/shell-experiments/base/shell/explorer-new/traywnd.c        
[iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/explorer-new/traywnd.c        
[iso-8859-1] Sat Oct 25 15:44:11 2014
@@ -1023,6 +1023,8 @@
                               cmdId,
                               pcmContext,
                               Context);
+
+        DestroyMenu(hPopup);
     }
 
     return cmdId;

Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp?rev=64986&r1=64985&r2=64986&view=diff
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp      
[iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp      
[iso-8859-1] Sat Oct 25 15:44:11 2014
@@ -1078,14 +1078,17 @@
         HICON icSmall = ImageList_GetIcon(himlSmall, indexOpen, 0);
         HICON icLarge = ImageList_GetIcon(himlLarge, indexOpen, 0);
 
-        HICON oldSmall = (HICON)SendMessage(WM_SETICON, ICON_SMALL, 
reinterpret_cast<LPARAM>(icSmall));
-        HICON oldLarge = (HICON)SendMessage(WM_SETICON, ICON_BIG,   
reinterpret_cast<LPARAM>(icLarge));
+        /* Hack to make it possible to release the old icons */
+        /* Something seems to go wrong with WM_SETICON */
+        HICON oldSmall = (HICON)SendMessage(WM_GETICON, ICON_SMALL, 0);
+        HICON oldLarge = (HICON)SendMessage(WM_GETICON, ICON_BIG,   0);
+
+        SendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icSmall));
+        SendMessage(WM_SETICON, ICON_BIG,   reinterpret_cast<LPARAM>(icLarge));
 
         DestroyIcon(oldSmall);
         DestroyIcon(oldLarge);
     }
-
-    // TODO: Update the window icon
 
     FireCommandStateChangeAll();
     hResult = UpdateForwardBackState();

Modified: branches/shell-experiments/dll/win32/shell32/newmenu.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/shell32/newmenu.cpp?rev=64986&r1=64985&r2=64986&view=diff
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/newmenu.cpp    [iso-8859-1] 
(original)
+++ branches/shell-experiments/dll/win32/shell32/newmenu.cpp    [iso-8859-1] 
Sat Oct 25 15:44:11 2014
@@ -179,7 +179,10 @@
     pNewItem->pwszExt = _wcsdup(pwszExt);
     pNewItem->pwszDesc = _wcsdup(fi.szTypeName);
     if (fi.hIcon)
+    {
         pNewItem->hBitmap = IconToBitmap(fi.hIcon);
+        DestroyIcon(fi.hIcon);
+    }
 
     return pNewItem;
 }

Modified: branches/shell-experiments/dll/win32/shell32/shlview.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/shell32/shlview.cpp?rev=64986&r1=64985&r2=64986&view=diff
==============================================================================
--- branches/shell-experiments/dll/win32/shell32/shlview.cpp    [iso-8859-1] 
(original)
+++ branches/shell-experiments/dll/win32/shell32/shlview.cpp    [iso-8859-1] 
Sat Oct 25 15:44:11 2014
@@ -984,7 +984,7 @@
         SHFree((LPITEMIDLIST)ntreg.pidl);
     }
 
-    m_hAccel = LoadAcceleratorsA(shell32_hInstance, MAKEINTRESOURCEA( 
IDA_SHELLVIEW));
+    m_hAccel = LoadAcceleratorsW(shell32_hInstance, 
MAKEINTRESOURCEW(IDA_SHELLVIEW));
 
     return S_OK;
 }

Modified: branches/shell-experiments/win32ss/user/ntuser/menu.c
URL: 
http://svn.reactos.org/svn/reactos/branches/shell-experiments/win32ss/user/ntuser/menu.c?rev=64986&r1=64985&r2=64986&view=diff
==============================================================================
--- branches/shell-experiments/win32ss/user/ntuser/menu.c       [iso-8859-1] 
(original)
+++ branches/shell-experiments/win32ss/user/ntuser/menu.c       [iso-8859-1] 
Sat Oct 25 15:44:11 2014
@@ -1653,7 +1653,7 @@
    {
       return NULL;
    }
-   SysMenu = IntGetMenuObject(hSysMenu);
+   SysMenu = UserGetMenuObject(hSysMenu);
    if (NULL == SysMenu)
    {
        UserDestroyMenu(hSysMenu);
@@ -1684,7 +1684,7 @@
          UserDestroyMenu(hSysMenu);
          return NULL;
       }
-      Menu = IntGetMenuObject(hNewMenu);
+      Menu = UserGetMenuObject(hNewMenu);
       if (!Menu)
       {
          IntReleaseMenuObject(SysMenu);


Reply via email to