diff options
Diffstat (limited to 'src/managers/eventLoop/EventLoopManager.cpp')
| -rw-r--r-- | src/managers/eventLoop/EventLoopManager.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/managers/eventLoop/EventLoopManager.cpp b/src/managers/eventLoop/EventLoopManager.cpp index c78bc551..5910e71a 100644 --- a/src/managers/eventLoop/EventLoopManager.cpp +++ b/src/managers/eventLoop/EventLoopManager.cpp @@ -31,7 +31,7 @@ void CEventLoopManager::enterLoop(wl_display* display, wl_event_loop* wlEventLoo void CEventLoopManager::onTimerFire() { for (auto& t : m_sTimers.timers) { - if (t->passed() && !t->cancelled()) + if (t.strongRef() > 1 /* if it's 1, it was lost. Don't call it. */ && t->passed() && !t->cancelled()) t->call(t); } @@ -62,6 +62,8 @@ static void timespecAddNs(timespec* pTimespec, int64_t delta) { } void CEventLoopManager::nudgeTimers() { + // remove timers that have gone missing + std::erase_if(m_sTimers.timers, [](const auto& t) { return t.strongRef() <= 1; }); long nextTimerUs = 10 * 1000 * 1000; // 10s |
