diff --git a/base/shell/explorer/syspager.cpp b/base/shell/explorer/syspager.cpp index 6706605bdb3..d657b2c6c40 100644 --- a/base/shell/explorer/syspager.cpp +++ b/base/shell/explorer/syspager.cpp @@ -168,6 +168,7 @@ public: void RefreshToolbarMetrics(BOOL bForceRefresh); private: + LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); LRESULT OnCtxMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); VOID SendMouseEvent(IN WORD wIndex, IN UINT uMsg, IN WPARAM wParam); LRESULT OnMouseEvent(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); @@ -175,6 +176,7 @@ private: public: BEGIN_MSG_MAP(CNotifyToolbar) + MESSAGE_HANDLER(WM_DESTROY, OnDestroy) MESSAGE_HANDLER(WM_CONTEXTMENU, OnCtxMenu) MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseEvent) NOTIFY_CODE_HANDLER(TTN_SHOW, OnTooltipShow) @@ -1031,6 +1033,17 @@ VOID CNotifyToolbar::ResizeImagelist() SetButtonSize(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON)); } +LRESULT CNotifyToolbar::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) +{ + if (m_ImageList) + { + ImageList_Destroy(m_ImageList); + m_ImageList = NULL; + } + + return 0; +} + LRESULT CNotifyToolbar::OnCtxMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { bHandled = FALSE; diff --git a/base/shell/explorer/taskswnd.cpp b/base/shell/explorer/taskswnd.cpp index a18dda78d8e..74efb5d85fc 100644 --- a/base/shell/explorer/taskswnd.cpp +++ b/base/shell/explorer/taskswnd.cpp @@ -276,7 +276,6 @@ public: if (!m_hThread) { m_bThreadRunning = FALSE; - CloseHandle(m_hThread); } } }; @@ -1557,6 +1556,13 @@ public: CloseThemeData(m_Theme); DeleteAllTasks(); + + if (m_ImageList) + { + ImageList_Destroy(m_ImageList); + m_ImageList = NULL; + } + return TRUE; } diff --git a/base/shell/explorer/traywnd.cpp b/base/shell/explorer/traywnd.cpp index 9d2f1a9a839..968440b1ae4 100644 --- a/base/shell/explorer/traywnd.cpp +++ b/base/shell/explorer/traywnd.cpp @@ -533,7 +533,9 @@ public: } } - CloseHandle(CreateThread(NULL, 0, s_RunFileDlgThread, this, 0, NULL)); + HANDLE hThread = CreateThread(NULL, 0, s_RunFileDlgThread, this, 0, NULL); + if (hThread) + CloseHandle(hThread); } DWORD WINAPI TrayPropertiesThread() @@ -587,7 +589,9 @@ public: } } - CloseHandle(CreateThread(NULL, 0, s_TrayPropertiesThread, this, 0, NULL)); + HANDLE hThread = CreateThread(NULL, 0, s_TrayPropertiesThread, this, 0, NULL); + if (hThread) + CloseHandle(hThread); return NULL; }