mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-05 04:39:08 +08:00
Ensure icon in context menu is not leaked (#709)
This commit is contained in:
parent
3c0b479669
commit
b490a72c1d
@ -24,6 +24,7 @@ CPowerRenameMenu::CPowerRenameMenu()
|
||||
CPowerRenameMenu::~CPowerRenameMenu()
|
||||
{
|
||||
m_spdo = nullptr;
|
||||
DeleteObject(m_hbmpIcon);
|
||||
DllRelease();
|
||||
}
|
||||
|
||||
@ -83,7 +84,11 @@ HRESULT CPowerRenameMenu::QueryContextMenu(HMENU hMenu, UINT index, UINT uIDFirs
|
||||
if (hIcon)
|
||||
{
|
||||
mii.fMask |= MIIM_BITMAP;
|
||||
mii.hbmpItem = CreateBitmapFromIcon(hIcon);
|
||||
if (m_hbmpIcon == NULL)
|
||||
{
|
||||
m_hbmpIcon = CreateBitmapFromIcon(hIcon);
|
||||
}
|
||||
mii.hbmpItem = m_hbmpIcon;
|
||||
DestroyIcon(hIcon);
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,7 @@ private:
|
||||
~CPowerRenameMenu();
|
||||
|
||||
long m_refCount = 1;
|
||||
HBITMAP m_hbmpIcon = NULL;
|
||||
CComPtr<IDataObject> m_spdo;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user