diff options
author | George Hazan <george.hazan@gmail.com> | 2016-05-13 19:31:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-05-13 19:31:10 +0000 |
commit | e73bb3845517a31fa795e8d2174fcc8572835b33 (patch) | |
tree | de8df67f838deae6ab9a74475aff6c71913890df /plugins/TabSRMM | |
parent | f4a41df7b0b39972ebff39377363718d49201159 (diff) |
memory leak in CB module
git-svn-id: http://svn.miranda-ng.org/main/trunk@16827 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/buttonsbar.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 9707fcdf58..5f882b5faa 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -245,38 +245,37 @@ static INT_PTR CB_SetButtonState(WPARAM wParam, LPARAM lParam) static INT_PTR CB_RemoveButton(WPARAM, LPARAM lParam) { - BBButton *bbdi = (BBButton *)lParam; + BBButton *bbdi = (BBButton*)lParam; if (!bbdi) return 1; - DWORD tempCID = 0; - DWORD dwFlags = 0; + CustomButtonData *pFound = NULL; { mir_cslock lck(csToolBar); for (int i = LButtonsList.getCount() - 1; i >= 0; i--) { CustomButtonData *cbd = LButtonsList[i]; if (!mir_strcmp(cbd->m_pszModuleName, bbdi->pszModuleName) && cbd->m_dwButtonOrigID == bbdi->dwButtonID) { - tempCID = cbd->m_dwButtonCID; - dwFlags = cbd->m_bLSided ? BBBF_ISLSIDEBUTTON : BBBF_ISRSIDEBUTTON; + pFound = cbd; LButtonsList.remove(i); } } - if (!tempCID) { + if (!pFound) { for (int i = RButtonsList.getCount() - 1; i >= 0; i--) { CustomButtonData *cbd = RButtonsList[i]; if (!mir_strcmp(cbd->m_pszModuleName, bbdi->pszModuleName) && cbd->m_dwButtonOrigID == bbdi->dwButtonID) { - tempCID = cbd->m_dwButtonCID; - dwFlags = cbd->m_bLSided ? BBBF_ISLSIDEBUTTON : BBBF_ISRSIDEBUTTON; + pFound = cbd; RButtonsList.remove(i); } } } } - if (tempCID) - M.BroadcastMessage(DM_CBDESTROY, (WPARAM)tempCID, (LPARAM)dwFlags); + if (pFound) { + M.BroadcastMessage(DM_CBDESTROY, pFound->m_dwButtonCID, pFound->m_bLSided ? BBBF_ISLSIDEBUTTON : BBBF_ISRSIDEBUTTON); + delete pFound; + } return 0; } |