aboutsummaryrefslogtreecommitdiff
path: root/backends/timer
diff options
context:
space:
mode:
authorJohannes Schickel2011-08-10 18:42:19 +0200
committerJohannes Schickel2011-08-10 18:42:19 +0200
commit930f626daba5de8ec0b42fd32ba7ddf107e7d95a (patch)
treef5e41b66eebf1def0da4a1e4b8d83b348f06df83 /backends/timer
parentc443f113ed5729b88792d3b54b77d70033cb24dc (diff)
downloadscummvm-rg350-930f626daba5de8ec0b42fd32ba7ddf107e7d95a.tar.gz
scummvm-rg350-930f626daba5de8ec0b42fd32ba7ddf107e7d95a.tar.bz2
scummvm-rg350-930f626daba5de8ec0b42fd32ba7ddf107e7d95a.zip
TIMER: Add a comment to explain why we remove the name in removeTimerProc.
Diffstat (limited to 'backends/timer')
-rw-r--r--backends/timer/default/default-timer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/backends/timer/default/default-timer.cpp b/backends/timer/default/default-timer.cpp
index 5b133660e0..e1aadb62b8 100644
--- a/backends/timer/default/default-timer.cpp
+++ b/backends/timer/default/default-timer.cpp
@@ -162,6 +162,18 @@ void DefaultTimerManager::removeTimerProc(TimerProc callback) {
}
}
+ // We need to remove all names referencing the timer proc here.
+ //
+ // Else we run into troubles, when the client code removes and readds timer
+ // callbacks.
+ //
+ // Another issues occurs when one plays a game with ALSA as music driver,
+ // does RTL and starts a different engine game with ALSA as music driver.
+ // In this case the MPU401 code will add different timer procs with the
+ // same name, resulting in two different callbacks added with the same
+ // name and causing installTimerProc to error out.
+ // A good test case is running a SCUMM with ALSA output and then a KYRA
+ // game for example.
for (TimerSlotMap::iterator i = _callbacks.begin(), end = _callbacks.end(); i != end; ++i) {
if (i->_value == callback)
_callbacks.erase(i);