summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-01-29 14:36:15 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-01-29 14:36:15 +0300
commit1a1474ff783f5e6a3759110bf63ace1d0d53bd83 (patch)
tree3df28de2dd2e947db5acc9eceb3f060be14e3664 /src
parentf5f0309106b5af3894e5db4b75d7a85b154d891b (diff)
fix for a rare crash on exit
Diffstat (limited to 'src')
-rw-r--r--src/mir_core/src/CDlgBase.cpp6
-rw-r--r--src/mir_core/src/CTimer.cpp6
-rw-r--r--src/mir_core/src/mir_core.def4
-rw-r--r--src/mir_core/src/mir_core64.def4
4 files changed, 16 insertions, 4 deletions
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