aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2003-10-17 16:30:24 +0000
committerMax Horn2003-10-17 16:30:24 +0000
commit96a8d0ec1cb7410d3790c822f2f9d5ce363daeb2 (patch)
tree3bfefdcb22643e249b82f0808e4ebeb889b01c33 /common
parent012450de73cbac232be2f779b14e64e28cbdfb92 (diff)
downloadscummvm-rg350-96a8d0ec1cb7410d3790c822f2f9d5ce363daeb2.tar.gz
scummvm-rg350-96a8d0ec1cb7410d3790c822f2f9d5ce363daeb2.tar.bz2
scummvm-rg350-96a8d0ec1cb7410d3790c822f2f9d5ce363daeb2.zip
proper fix for COMI timer issue: don't let a Timer remove itself
svn-id: r10867
Diffstat (limited to 'common')
-rw-r--r--common/timer.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/common/timer.cpp b/common/timer.cpp
index 92229eecd6..f96a2e553a 100644
--- a/common/timer.cpp
+++ b/common/timer.cpp
@@ -91,12 +91,10 @@ int Timer::handler(int t) {
for (l = 0; l < MAX_TIMERS; l++) {
if (_timerSlots[l].procedure && _timerSlots[l].interval > 0) {
_timerSlots[l].counter -= interval;
- // FIXME: We only check the value of _timerSlots[l].interval here
- // because the timer might remove itself.
- // Strictly spoken, that is a dirty thing to do for a timer, but for
- // now the bundle timer requires this. Of course the whole bundle
- // music timer is kind of scary anyway...
- while (_timerSlots[l].counter <= 0 && _timerSlots[l].interval > 0) {
+ while (_timerSlots[l].counter <= 0) {
+ // A small paranoia check which catches the case where
+ // a timer removes itself (which it never should do).
+ assert(_timerSlots[l].procedure && _timerSlots[l].interval > 0);
_timerSlots[l].counter += _timerSlots[l].interval;
_timerSlots[l].procedure(_timerSlots[l].refCon);
}