diff options
author | Max Horn | 2003-10-17 11:17:49 +0000 |
---|---|---|
committer | Max Horn | 2003-10-17 11:17:49 +0000 |
commit | 37085bfe8810f35b753cf234b5b5e8288cc0b823 (patch) | |
tree | 4335d2f1916d80f338568b65deba4ba32098473c | |
parent | 7f5c5f0f8bff4e786c28da398589fb1fb5b386c0 (diff) | |
download | scummvm-rg350-37085bfe8810f35b753cf234b5b5e8288cc0b823.tar.gz scummvm-rg350-37085bfe8810f35b753cf234b5b5e8288cc0b823.tar.bz2 scummvm-rg350-37085bfe8810f35b753cf234b5b5e8288cc0b823.zip |
fix (workaround) for bug #825331
svn-id: r10853
-rw-r--r-- | common/timer.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/common/timer.cpp b/common/timer.cpp index ba5c82ef92..92229eecd6 100644 --- a/common/timer.cpp +++ b/common/timer.cpp @@ -89,10 +89,14 @@ int Timer::handler(int t) { interval = 1000 * (_thisTime - _lastTime); for (l = 0; l < MAX_TIMERS; l++) { - if ((_timerSlots[l].procedure) && (_timerSlots[l].interval > 0)) { + if (_timerSlots[l].procedure && _timerSlots[l].interval > 0) { _timerSlots[l].counter -= interval; - while (_timerSlots[l].counter <= 0) { - assert(_timerSlots[l].interval > 0); + // 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) { _timerSlots[l].counter += _timerSlots[l].interval; _timerSlots[l].procedure(_timerSlots[l].refCon); } @@ -108,10 +112,10 @@ bool Timer::installProcedure(TimerProc procedure, int32 interval, void *refCon) for (int l = 0; l < MAX_TIMERS; l++) { if (!_timerSlots[l].procedure) { + _timerSlots[l].procedure = procedure; _timerSlots[l].interval = interval; _timerSlots[l].counter = interval; _timerSlots[l].refCon = refCon; - _timerSlots[l].procedure = procedure; return true; } } |