From 89adba5b627d14ee6a690be906b5371201d0e8c1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 4 Nov 2023 17:42:25 +0300 Subject: fixes #3786 (Random crash on window's destruction) --- src/mir_core/src/Windows/CCtrlBase.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/mir_core/src/Windows/CCtrlBase.cpp b/src/mir_core/src/Windows/CCtrlBase.cpp index ad80ccffe7..f9ac6413e0 100644 --- a/src/mir_core/src/Windows/CCtrlBase.cpp +++ b/src/mir_core/src/Windows/CCtrlBase.cpp @@ -52,12 +52,10 @@ 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); + int idx = arControls.indexOf(this); + if (idx != -1) { + Unsubclass(); + arControls.remove(idx); } m_hwnd = nullptr; -- cgit v1.2.3