Skip to content

Commit

Permalink
TIMER: Add a comment to explain why we remove the name in removeTimer…
Browse files Browse the repository at this point in the history
…Proc.
  • Loading branch information
Johannes Schickel committed Aug 10, 2011
1 parent c443f11 commit 930f626
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions backends/timer/default/default-timer.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 930f626

Please sign in to comment.