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:
parent
541c8c407b
commit
59d097bcea
1 changed files with 9 additions and 0 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue