From 9caec47adf266946fdce290aaf5ec0c865197650 Mon Sep 17 00:00:00 2001 From: crupest Date: Wed, 19 Sep 2018 22:39:16 +0800 Subject: Add InvokeLater in KillTimer. --- CruUI/timer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'CruUI/timer.cpp') diff --git a/CruUI/timer.cpp b/CruUI/timer.cpp index f596dde4..ce800eee 100644 --- a/CruUI/timer.cpp +++ b/CruUI/timer.cpp @@ -22,7 +22,11 @@ namespace cru if (find_result != map_.cend()) { ::KillTimer(Application::GetInstance()->GetGodWindow()->GetHandle(), id); - map_.erase(find_result); + // When timer is killed in tick action, we need to retain the action itself until the action finishes, so InvokeLater! + InvokeLater([=] + { + map_.erase(find_result); + }); } } -- cgit v1.2.3