[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.

svn path=/branches/shell-experiments/; revision=64986
This commit is contained in:
David Quintana 2014-10-25 15:44:11 +00:00
parent 8069b8c90d
commit d07a1dc09a
5 changed files with 15 additions and 7 deletions

View file

@ -1023,6 +1023,8 @@ ITrayWindowImpl_TrackCtxMenu(IN OUT ITrayWindowImpl *This,
cmdId, cmdId,
pcmContext, pcmContext,
Context); Context);
DestroyMenu(hPopup);
} }
return cmdId; return cmdId;

View file

@ -1078,15 +1078,18 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
HICON icSmall = ImageList_GetIcon(himlSmall, indexOpen, 0); HICON icSmall = ImageList_GetIcon(himlSmall, indexOpen, 0);
HICON icLarge = ImageList_GetIcon(himlLarge, indexOpen, 0); HICON icLarge = ImageList_GetIcon(himlLarge, indexOpen, 0);
HICON oldSmall = (HICON)SendMessage(WM_SETICON, ICON_SMALL, reinterpret_cast<LPARAM>(icSmall)); /* Hack to make it possible to release the old icons */
HICON oldLarge = (HICON)SendMessage(WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(icLarge)); /* 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(oldSmall);
DestroyIcon(oldLarge); DestroyIcon(oldLarge);
} }
// TODO: Update the window icon
FireCommandStateChangeAll(); FireCommandStateChangeAll();
hResult = UpdateForwardBackState(); hResult = UpdateForwardBackState();
return S_OK; return S_OK;

View file

@ -179,7 +179,10 @@ CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPCWSTR pwszExt)
pNewItem->pwszExt = _wcsdup(pwszExt); pNewItem->pwszExt = _wcsdup(pwszExt);
pNewItem->pwszDesc = _wcsdup(fi.szTypeName); pNewItem->pwszDesc = _wcsdup(fi.szTypeName);
if (fi.hIcon) if (fi.hIcon)
{
pNewItem->hBitmap = IconToBitmap(fi.hIcon); pNewItem->hBitmap = IconToBitmap(fi.hIcon);
DestroyIcon(fi.hIcon);
}
return pNewItem; return pNewItem;
} }

View file

@ -984,7 +984,7 @@ LRESULT CDefView::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl
SHFree((LPITEMIDLIST)ntreg.pidl); SHFree((LPITEMIDLIST)ntreg.pidl);
} }
m_hAccel = LoadAcceleratorsA(shell32_hInstance, MAKEINTRESOURCEA( IDA_SHELLVIEW)); m_hAccel = LoadAcceleratorsW(shell32_hInstance, MAKEINTRESOURCEW(IDA_SHELLVIEW));
return S_OK; return S_OK;
} }

View file

@ -1653,7 +1653,7 @@ PMENU FASTCALL MENU_GetSystemMenu(PWND Window, PMENU Popup)
{ {
return NULL; return NULL;
} }
SysMenu = IntGetMenuObject(hSysMenu); SysMenu = UserGetMenuObject(hSysMenu);
if (NULL == SysMenu) if (NULL == SysMenu)
{ {
UserDestroyMenu(hSysMenu); UserDestroyMenu(hSysMenu);
@ -1684,7 +1684,7 @@ PMENU FASTCALL MENU_GetSystemMenu(PWND Window, PMENU Popup)
UserDestroyMenu(hSysMenu); UserDestroyMenu(hSysMenu);
return NULL; return NULL;
} }
Menu = IntGetMenuObject(hNewMenu); Menu = UserGetMenuObject(hNewMenu);
if (!Menu) if (!Menu)
{ {
IntReleaseMenuObject(SysMenu); IntReleaseMenuObject(SysMenu);