diff options
Diffstat (limited to 'src/mir_core')
-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(); } |