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.
This commit is contained in:
Mathias Gumz 2012-09-14 08:48:37 +02:00
parent 541c8c407b
commit 59d097bcea

View file

@ -112,7 +112,16 @@ Timer::~Timer() {
void Timer::setTimeout(uint64_t timeout) { void Timer::setTimeout(uint64_t timeout) {
bool was_timing = isTiming();
if (was_timing) {
stop();
}
m_timeout = timeout; m_timeout = timeout;
if (was_timing) {
start();
}
} }
void Timer::setCommand(const RefCount<Slot<void> > &cmd) { void Timer::setCommand(const RefCount<Slot<void> > &cmd) {