From 59d097bcead9b349e20a4ec193d76330e6899e53 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Fri, 14 Sep 2012 08:48:37 +0200 Subject: Fix bug: (re)setting timeouts on a running FbTk::Timer might lead to broken timer list Setting a new timeout on a running FbTk::Timer must remove it from the timerlist, otherwise the list is not ordered correctly anymore. So, we stop the running FbTk::Timer, set the new timeout and restart it. --- src/FbTk/Timer.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/FbTk/Timer.cc b/src/FbTk/Timer.cc index 6a478bd..38f1a32 100644 --- a/src/FbTk/Timer.cc +++ b/src/FbTk/Timer.cc @@ -112,7 +112,16 @@ Timer::~Timer() { void Timer::setTimeout(uint64_t timeout) { + + bool was_timing = isTiming(); + if (was_timing) { + stop(); + } m_timeout = timeout; + + if (was_timing) { + start(); + } } void Timer::setCommand(const RefCount > &cmd) { -- cgit v0.11.2