diff options
author | George Hazan <george.hazan@gmail.com> | 2023-11-04 17:42:25 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-11-04 17:42:25 +0300 |
commit | 89adba5b627d14ee6a690be906b5371201d0e8c1 (patch) | |
tree | ea43f09285f90bd928c0debea87c8d4cd7484a48 | |
parent | b5d430ee1b8f1a30a5fb3c44d18a369ae5566bb5 (diff) |
fixes #3786 (Random crash on window's destruction)
-rw-r--r-- | src/mir_core/src/Windows/CCtrlBase.cpp | 10 |
1 files 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;
|