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 | |
parent | f63eb2bfc28dff8bbf9d56dd57b2bc6b53487f56 (diff) |
fixes crash in StdMsg on opening SRMM window
-rw-r--r-- | include/m_gui.h | 2 | ||||
-rw-r--r-- | src/mir_core/src/CCtrlBase.cpp | 17 | ||||
-rw-r--r-- | src/mir_core/src/CCtrlPages.cpp | 2 |
3 files changed, 15 insertions, 6 deletions
diff --git a/include/m_gui.h b/include/m_gui.h index 2c3bba960b..6c00623959 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -493,7 +493,7 @@ class MIR_CORE_EXPORT CCtrlBase public:
CCtrlBase(CDlgBase *wnd, int idCtrl);
- virtual ~CCtrlBase() { }
+ virtual ~CCtrlBase();
__forceinline HWND GetHwnd() const { return m_hwnd; }
__forceinline int GetCtrlId() const { return m_idCtrl; }
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(); } |