diff options
author | George Hazan <ghazan@miranda.im> | 2017-06-02 12:08:21 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-06-02 12:08:21 +0300 |
commit | dd43832a82e3d4ca099aa82b0b1ba16382756241 (patch) | |
tree | 52ae02b3696f9e1dbd412de37cc34962d954aa08 /src | |
parent | f63eb2bfc28dff8bbf9d56dd57b2bc6b53487f56 (diff) |
fixes crash in StdMsg on opening SRMM window
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_core/src/CCtrlBase.cpp | 17 | ||||
-rw-r--r-- | src/mir_core/src/CCtrlPages.cpp | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/mir_core/src/CCtrlBase.cpp b/src/mir_core/src/CCtrlBase.cpp index 6f57818940..6365ead6e7 100644 --- a/src/mir_core/src/CCtrlBase.cpp +++ b/src/mir_core/src/CCtrlBase.cpp @@ -44,6 +44,10 @@ CCtrlBase::CCtrlBase(CDlgBase *wnd, int idCtrl) wnd->AddControl(this); } +CCtrlBase::~CCtrlBase() +{ +} + void CCtrlBase::OnInit() { m_hwnd = (m_idCtrl && m_parentWnd && m_parentWnd->GetHwnd()) ? GetDlgItem(m_parentWnd->GetHwnd(), m_idCtrl) : nullptr; @@ -51,6 +55,14 @@ void CCtrlBase::OnInit() void CCtrlBase::OnDestroy() { + PVOID bullshit[2]; // vfptr + hwnd + bullshit[1] = m_hwnd; + CCtrlBase *pCtrl = arControls.find((CCtrlBase*)&bullshit); + if (pCtrl) { + pCtrl->Unsubclass(); + arControls.remove(pCtrl); + } + m_hwnd = nullptr; } @@ -163,11 +175,6 @@ LRESULT CALLBACK CCtrlBase::GlobalSubclassWndProc(HWND hwnd, UINT msg, WPARAM wP CCtrlBase *pCtrl = arControls.find((CCtrlBase*)&bullshit); if (pCtrl) { LRESULT res = pCtrl->CustomWndProc(msg, wParam, lParam); - if (msg == WM_DESTROY) { - pCtrl->Unsubclass(); - arControls.remove(pCtrl); - } - if (res != 0) return res; } diff --git a/src/mir_core/src/CCtrlPages.cpp b/src/mir_core/src/CCtrlPages.cpp index deb6dcd756..1d2d08694d 100644 --- a/src/mir_core/src/CCtrlPages.cpp +++ b/src/mir_core/src/CCtrlPages.cpp @@ -384,4 +384,6 @@ void CCtrlPages::OnDestroy() TabCtrl_SetImageList(m_hwnd, nullptr); ImageList_Destroy(m_hIml); } + + CSuper::OnDestroy(); } |