aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/Timer.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2012-09-14 06:48:37 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2012-09-14 06:48:37 (GMT)
commit59d097bcead9b349e20a4ec193d76330e6899e53 (patch)
tree0b751bd425c2ee42254d04496512b79f15984ff8 /src/FbTk/Timer.cc
parent541c8c407b7ba8dd10f85bb48bcb5900270b3f84 (diff)
downloadfluxbox-59d097bcead9b349e20a4ec193d76330e6899e53.zip
fluxbox-59d097bcead9b349e20a4ec193d76330e6899e53.tar.bz2
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.
Diffstat (limited to 'src/FbTk/Timer.cc')
-rw-r--r--src/FbTk/Timer.cc9
1 files changed, 9 insertions, 0 deletions
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() {
112 112
113 113
114void Timer::setTimeout(uint64_t timeout) { 114void Timer::setTimeout(uint64_t timeout) {
115
116 bool was_timing = isTiming();
117 if (was_timing) {
118 stop();
119 }
115 m_timeout = timeout; 120 m_timeout = timeout;
121
122 if (was_timing) {
123 start();
124 }
116} 125}
117 126
118void Timer::setCommand(const RefCount<Slot<void> > &cmd) { 127void Timer::setCommand(const RefCount<Slot<void> > &cmd) {