mirror of
https://github.com/reactos/reactos.git
synced 2026-06-09 01:12:59 +08:00
[EXPLORER] Fix handle leaks (#8516)
JIRA issue: CORE-15616 JIRA issue: CORE-14382 The Explorer shell has multiple resource leaks causing handle exhaustion over extended use.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user