Author: dquintana Date: Tue Jun 3 01:04:19 2014 New Revision: 63537
URL: http://svn.reactos.org/svn/reactos?rev=63537&view=rev Log: [BROWSEUI] * Plug a few menu leaks. In Windows, it brings down the leaked menus from 20 per navigation, to only 1-2. In ReactOS, from 60 to 20.
[RSHELL,SHELL32] * Code tweaks that shouldn't change the actual behaviour.
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp branches/shell-experiments/base/shell/rshell/CMenuToolbars.h branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp branches/shell-experiments/dll/win32/shell32/shlview.cpp
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rsh... ============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.cpp [iso-8859-1] Tue Jun 3 01:04:19 2014 @@ -1095,6 +1095,10 @@ { }
+CMenuStaticToolbar::~CMenuStaticToolbar() +{ +} + HRESULT CMenuStaticToolbar::GetMenu( _Out_opt_ HMENU *phmenu, _Out_opt_ HWND *phwnd,
Modified: branches/shell-experiments/base/shell/rshell/CMenuToolbars.h URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rsh... ============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuToolbars.h [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuToolbars.h [iso-8859-1] Tue Jun 3 01:04:19 2014 @@ -132,7 +132,7 @@
public: CMenuStaticToolbar(CMenuBand *menuBand); - virtual ~CMenuStaticToolbar() {} + virtual ~CMenuStaticToolbar();
HRESULT SetMenu(HMENU hmenu, HWND hwnd, DWORD dwFlags); HRESULT GetMenu(HMENU *phmenu, HWND *phwnd, DWORD *pdwFlags);
Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/brow... ============================================================================== --- branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Tue Jun 3 01:04:19 2014 @@ -1680,6 +1680,8 @@ SendMessage(fToolbarWindow, TB_CUSTOMIZE, 0, 0); break; } + + DestroyMenu(contextMenuBar); return 1; }
Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/brow... ============================================================================== --- branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Tue Jun 3 01:04:19 2014 @@ -1571,8 +1571,15 @@ DeleteMenu(theMenu, IDM_VIEW_TOOLBARS, MF_BYCOMMAND); else { + menuItemInfo.cbSize = sizeof(menuItemInfo); + menuItemInfo.fMask = MIIM_SUBMENU; + GetMenuItemInfo(theMenu, IDM_VIEW_TOOLBARS, FALSE, &menuItemInfo); + DestroyMenu(menuItemInfo.hSubMenu); + toolbarMenuBar = LoadMenu(_AtlBaseModule.GetResourceInstance(), MAKEINTRESOURCE(IDM_CABINET_CONTEXTMENU)); toolbarMenu = GetSubMenu(toolbarMenuBar, 0); + RemoveMenu(toolbarMenuBar, 0, MF_BYPOSITION); + DestroyMenu(toolbarMenuBar);
SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_STANDARDBUTTONS, commandList[0].cmdf); SHCheckMenuItem(toolbarMenu, IDM_TOOLBARS_ADDRESSBAR, commandList[1].cmdf & OLECMDF_ENABLED); @@ -1847,6 +1854,8 @@ int GCCU(itemCount3) = GetMenuItemCount(hmenuShared); Unused(itemCount3);
+ DestroyMenu(mainMenu); + lpMenuWidths->width[0] = 2; lpMenuWidths->width[2] = 3; lpMenuWidths->width[4] = 1;
Modified: branches/shell-experiments/dll/win32/shell32/shlview.cpp URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/shel... ============================================================================== --- branches/shell-experiments/dll/win32/shell32/shlview.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/shell32/shlview.cpp [iso-8859-1] Tue Jun 3 01:04:19 2014 @@ -1383,9 +1383,7 @@ for (int i = 0; i < mic; i++) { HMENU submenu = GetSubMenu(m_hMenu, 0); - RemoveMenu(m_hMenu, 0, MF_BYPOSITION); - if (submenu) - DestroyMenu(submenu); + DeleteMenu(m_hMenu, 0, MF_BYPOSITION); }
m_pShellBrowser->InsertMenusSB(m_hMenu, &omw);