diff --git a/laf b/laf index d727d1e53..e189f4887 160000 --- a/laf +++ b/laf @@ -1 +1 @@ -Subproject commit d727d1e53ca08fd38e99dacdef5b3fd643a83b63 +Subproject commit e189f488718dac5ef9a7c285f69aca724dce4714 diff --git a/src/ui/manager.cpp b/src/ui/manager.cpp index cf76a447d..84879885a 100644 --- a/src/ui/manager.cpp +++ b/src/ui/manager.cpp @@ -189,7 +189,7 @@ Manager::~Manager() set_mouse_cursor(kNoCursor); // Destroy timers - Timer::checkNoTimers(); + ASSERT(!Timer::haveTimers()); // Destroy filters #ifdef _DEBUG @@ -325,8 +325,10 @@ void Manager::generateMessagesFromOSEvents() // Events from "she" layer. os::Event sheEvent; for (;;) { - // bool canWait = (msg_queue.empty()); - bool canWait = false; + // TODO Add timers to laf::os library so we can wait for then in + // the OS message loop. + bool canWait = (msg_queue.empty() && + !Timer::haveRunningTimers()); m_eventQueue->getEvent(sheEvent, canWait); if (sheEvent.type() == os::Event::None) diff --git a/src/ui/timer.cpp b/src/ui/timer.cpp index 6658c61cf..dd7a72289 100644 --- a/src/ui/timer.cpp +++ b/src/ui/timer.cpp @@ -97,9 +97,21 @@ void Timer::pollTimers() } } -void Timer::checkNoTimers() +bool Timer::haveTimers() { - ASSERT(timers.empty()); + return !timers.empty(); +} + +bool Timer::haveRunningTimers() +{ + if (!timers.empty()) { + for (auto timer : timers) { + if (timer && timer->isRunning()) { + return true; + } + } + } + return false; } } // namespace ui diff --git a/src/ui/timer.h b/src/ui/timer.h index 2c632287e..9394f24af 100644 --- a/src/ui/timer.h +++ b/src/ui/timer.h @@ -36,7 +36,8 @@ namespace ui { obs::signal Tick; static void pollTimers(); - static void checkNoTimers(); + static bool haveTimers(); + static bool haveRunningTimers(); protected: virtual void onTick();