diff options
author | Mathias Gumz <akira at fluxbox dot org> | 2012-09-14 06:48:37 (GMT) |
---|---|---|
committer | Mathias Gumz <akira at fluxbox dot org> | 2012-09-14 06:48:37 (GMT) |
commit | 59d097bcead9b349e20a4ec193d76330e6899e53 (patch) | |
tree | 0b751bd425c2ee42254d04496512b79f15984ff8 /src | |
parent | 541c8c407b7ba8dd10f85bb48bcb5900270b3f84 (diff) | |
download | fluxbox-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')
-rw-r--r-- | src/FbTk/Timer.cc | 9 |
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 | ||
114 | void Timer::setTimeout(uint64_t timeout) { | 114 | void 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 | ||
118 | void Timer::setCommand(const RefCount<Slot<void> > &cmd) { | 127 | void Timer::setCommand(const RefCount<Slot<void> > &cmd) { |