Skip to content

Commit

Permalink
Removed call to DeleteObject for HBITMAP handle because some extensio…
Browse files Browse the repository at this point in the history
…ns (e.g. TortoiseHg) use a bitmap cache which will crash if the bitmap is deleted
  • Loading branch information
ContextQuickie committed Nov 30, 2020
1 parent a684dc7 commit 103ea71
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Source/Common/ExplorerContextMenuEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ namespace ContextQuickie

ExplorerContextMenuEntry::ExplorerContextMenuEntry()
{

}

ExplorerContextMenuEntry::ExplorerContextMenuEntry(IContextMenu* contextMenu, HMENU menu, int32_t index)
Expand Down Expand Up @@ -154,7 +153,9 @@ namespace ContextQuickie

if (this->BitmapHandle != nullptr)
{
DeleteObject((HBITMAP)this->BitmapHandle);
// Do not delete the bitmap object.
// Some extensions (e.g. TortoiseHg) use a bitmap cache which will crash if the bitmap is deleted
// DeleteObject(this->BitmapHandle);
}

if (this->Text != nullptr)
Expand Down
12 changes: 10 additions & 2 deletions Source/ExplorerContextMenu.Console/ExplorerContextMenu.Console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,16 @@ int wmain(int argc, wchar_t* argv[], wchar_t* envp[])
}

set<wstring> whitelist;
// 7-Zip: whitelist.insert(L"{23170F69-40C1-278A-1000-000100020000}");
// Notepad++: whitelist.insert(L"{B298D29A-A6ED-11DE-BA8C-A68E55D89593}");

// 7-Zip:
// whitelist.insert(L"{23170F69-40C1-278A-1000-000100020000}");

// Notepad++:
// whitelist.insert(L"{B298D29A-A6ED-11DE-BA8C-A68E55D89593}");

// TortoiseHg:
whitelist.insert(L"{46605027-5B8C-4DCE-BFE0-051B7972D64C}");

ExplorerContextMenu contextMenu(paths, true, whitelist);
contextMenu.PrintMenu();
return 0;
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 103ea71

Please sign in to comment.