[Scummvm-cvs-logs] scummvm master -> 930f626daba5de8ec0b42fd32ba7ddf107e7d95a

lordhoto lordhoto at gmail.com
Wed Aug 10 18:46:11 CEST 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c443f113ed TIMER: Remove all names associated with a callback, since all callbacks are removed.
930f626dab TIMER: Add a comment to explain why we remove the name in removeTimerProc.


Commit: c443f113ed5729b88792d3b54b77d70033cb24dc
    https://github.com/scummvm/scummvm/commit/c443f113ed5729b88792d3b54b77d70033cb24dc
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-08-10T09:34:08-07:00

Commit Message:
TIMER: Remove all names associated with a callback, since all callbacks are removed.

This makes the name removal consistent with the timer proc removal.

It seems we only allow a specific timer proc being added once anymore though.
So this should not change too much right now.

Changed paths:
    backends/timer/default/default-timer.cpp



diff --git a/backends/timer/default/default-timer.cpp b/backends/timer/default/default-timer.cpp
index 28524bf..5b13366 100644
--- a/backends/timer/default/default-timer.cpp
+++ b/backends/timer/default/default-timer.cpp
@@ -163,9 +163,7 @@ void DefaultTimerManager::removeTimerProc(TimerProc callback) {
 	}
 
 	for (TimerSlotMap::iterator i = _callbacks.begin(), end = _callbacks.end(); i != end; ++i) {
-		if (i->_value == callback) {
+		if (i->_value == callback)
 			_callbacks.erase(i);
-			break;
-		}
 	}
 }


Commit: 930f626daba5de8ec0b42fd32ba7ddf107e7d95a
    https://github.com/scummvm/scummvm/commit/930f626daba5de8ec0b42fd32ba7ddf107e7d95a
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-08-10T09:42:19-07:00

Commit Message:
TIMER: Add a comment to explain why we remove the name in removeTimerProc.

Changed paths:
    backends/timer/default/default-timer.cpp



diff --git a/backends/timer/default/default-timer.cpp b/backends/timer/default/default-timer.cpp
index 5b13366..e1aadb6 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);






More information about the Scummvm-git-logs mailing list