From 86aa5e64845fc16d46079b577f55db6ebcef6cc9 Mon Sep 17 00:00:00 2001 From: Asaq Date: Fri, 17 Nov 2017 19:59:16 +0300 Subject: [PATCH] Fix GDI objects leak problem Fix #1017, close #3896 --- PowerEditor/src/tools/NppShell/src/NppShell.cpp | 7 ++++++- PowerEditor/src/tools/NppShell/src/NppShell.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) mode change 100644 => 100755 PowerEditor/src/tools/NppShell/src/NppShell.cpp mode change 100644 => 100755 PowerEditor/src/tools/NppShell/src/NppShell.h diff --git a/PowerEditor/src/tools/NppShell/src/NppShell.cpp b/PowerEditor/src/tools/NppShell/src/NppShell.cpp old mode 100644 new mode 100755 index 60239f8d..5ae94796 --- a/PowerEditor/src/tools/NppShell/src/NppShell.cpp +++ b/PowerEditor/src/tools/NppShell/src/NppShell.cpp @@ -467,7 +467,8 @@ CShellExt::CShellExt() : m_nameLength(0), m_nameMaxLength(maxText), m_isDynamic(false), - m_winVer(0) + m_winVer(0), + m_hBitmap(NULL) { TCHAR szKeyTemp [MAX_PATH + GUID_STRING_SIZE]; ZeroMemory(&m_stgMedium, sizeof(m_stgMedium)); @@ -533,6 +534,9 @@ CShellExt::~CShellExt() { DeinitTheming(); } + if (m_hBitmap != NULL && m_hBitmap != HBMMENU_CALLBACK) + DeleteBitmap(m_hBitmap); + if (m_pDataObj) m_pDataObj->Release(); _cRef--; @@ -648,6 +652,7 @@ STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmd } } + m_hBitmap = icon; } m_hMenu = hMenu; diff --git a/PowerEditor/src/tools/NppShell/src/NppShell.h b/PowerEditor/src/tools/NppShell/src/NppShell.h old mode 100644 new mode 100755 index a98bdd48..6e806f21 --- a/PowerEditor/src/tools/NppShell/src/NppShell.h +++ b/PowerEditor/src/tools/NppShell/src/NppShell.h @@ -91,6 +91,7 @@ private: int m_nameLength; int m_nameMaxLength; bool m_isDynamic; + HBITMAP m_hBitmap; DWORD m_winVer; //current windows version