diff options
| author | Maxime Coste <mawww@kakoune.org> | 2016-12-06 13:55:53 +0000 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2016-12-06 13:55:53 +0000 |
| commit | e9349cdc9239a18bb77aa768210e22a2c013eb81 (patch) | |
| tree | b7071be326a83b134100175c41ca84bf6d55d4e1 /src | |
| parent | b3ac733f332a753be2fc575328d38017f31d0a00 (diff) | |
Ensure timers are still alive when trying to run them
Diffstat (limited to 'src')
| -rw-r--r-- | src/event_manager.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/event_manager.cc b/src/event_manager.cc index 221a6d0d..11fb5c44 100644 --- a/src/event_manager.cc +++ b/src/event_manager.cc @@ -133,9 +133,10 @@ void EventManager::handle_next_events(EventMode mode, sigset_t* sigmask) } TimePoint now = Clock::now(); - for (auto& timer : m_timers) + auto timers = m_timers; // copy timers in case m_timers gets mutated + for (auto& timer : timers) { - if (timer->next_date() <= now) + if (contains(m_timers, timer) and timer->next_date() <= now) timer->run(mode); } } |
