From 37085bfe8810f35b753cf234b5b5e8288cc0b823 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 17 Oct 2003 11:17:49 +0000 Subject: fix (workaround) for bug #825331 svn-id: r10853 --- common/timer.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'common') 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; } } -- cgit v1.2.3