From 1a1474ff783f5e6a3759110bf63ace1d0d53bd83 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 29 Jan 2020 14:36:15 +0300 Subject: fix for a rare crash on exit --- src/mir_core/src/CDlgBase.cpp | 6 ++++++ src/mir_core/src/CTimer.cpp | 6 ++++++ src/mir_core/src/mir_core.def | 4 ++-- src/mir_core/src/mir_core64.def | 4 ++-- 4 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mir_core/src/CDlgBase.cpp b/src/mir_core/src/CDlgBase.cpp index 62e1463c19..4ac2d5751d 100644 --- a/src/mir_core/src/CDlgBase.cpp +++ b/src/mir_core/src/CDlgBase.cpp @@ -452,6 +452,12 @@ void CDlgBase::AddTimer(CTimer *timer) m_timers.insert(timer); } +void CDlgBase::RemoveTimer(UINT_PTR idEvent) +{ + CTimer search(nullptr, idEvent); + m_timers.remove(&search); +} + CTimer* CDlgBase::FindTimer(int idEvent) { CTimer search(nullptr, idEvent); diff --git a/src/mir_core/src/CTimer.cpp b/src/mir_core/src/CTimer.cpp index b0e990e05f..2525031dff 100644 --- a/src/mir_core/src/CTimer.cpp +++ b/src/mir_core/src/CTimer.cpp @@ -32,6 +32,12 @@ CTimer::CTimer(CDlgBase *wnd, UINT_PTR idEvent) wnd->AddTimer(this); } +CTimer::~CTimer() +{ + if (m_wnd) + m_wnd->RemoveTimer(m_idEvent); +} + BOOL CTimer::OnTimer() { OnEvent(this); diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 8cf65ac054..7254c631aa 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1025,8 +1025,8 @@ CallFunctionSync @1170 Utils_IsRtl @1240 HookTemporaryEvent @1241 ?Click@CCtrlButton@@QAEXXZ @1242 NONAME -??0CTimer@@QAE@$$QAV0@@Z @1243 NONAME -??4CTimer@@QAEAAV0@$$QAV0@@Z @1244 NONAME +??1CTimer@@QAE@XZ @1243 NONAME +?RemoveTimer@CDlgBase@@IAEXI@Z @1244 NONAME IsTerminalDisconnected @1245 ?FindControl@CDlgBase@@QAEPAVCCtrlBase@@H@Z @1246 NONAME ?FindControl@CDlgBase@@QAEPAVCCtrlBase@@PAUHWND__@@@Z @1247 NONAME diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index ad6aff5753..1aca6aa620 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1025,8 +1025,8 @@ CallFunctionSync @1170 Utils_IsRtl @1240 HookTemporaryEvent @1241 ?Click@CCtrlButton@@QEAAXXZ @1242 NONAME -??0CTimer@@QEAA@$$QEAV0@@Z @1243 NONAME -??4CTimer@@QEAAAEAV0@$$QEAV0@@Z @1244 NONAME +??1CTimer@@QEAA@XZ @1243 NONAME +?RemoveTimer@CDlgBase@@IEAAX_K@Z @1244 NONAME IsTerminalDisconnected @1245 ?FindControl@CDlgBase@@QEAAPEAVCCtrlBase@@H@Z @1246 NONAME ?FindControl@CDlgBase@@QEAAPEAVCCtrlBase@@PEAUHWND__@@@Z @1247 NONAME -- cgit v1.2.3