[Scummvm-cvs-logs] CVS: scummvm/sound mixer.cpp,1.63,1.64
Max Horn
fingolfin at users.sourceforge.net
Sun Jul 6 08:58:10 CEST 2003
Update of /cvsroot/scummvm/scummvm/sound
In directory sc8-pr-cvs1:/tmp/cvs-serv23817
Modified Files:
mixer.cpp
Log Message:
the mutex must be locked by everything which might access _channels while the mixer thread is running, because the mixer thread may modify _channels
Index: mixer.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sound/mixer.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- mixer.cpp 6 Jul 2003 06:36:26 -0000 1.63
+++ mixer.cpp 6 Jul 2003 15:57:33 -0000 1.64
@@ -309,6 +309,7 @@
}
void SoundMixer::stopAll() {
+ StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i])
_channels[i]->destroy();
@@ -320,12 +321,13 @@
return;
}
+ StackLock lock(_mutex);
if (_channels[index])
_channels[index]->destroy();
}
void SoundMixer::stopID(int id) {
-
+ StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++) {
if (_channels[i] != NULL && _channels[i]->_id == id) {
_channels[i]->destroy();
@@ -343,6 +345,7 @@
// (and maybe also voice) here to work properly in iMuseDigital
// games. In the past that was achieve using the _beginSlots hack.
// Since we don't have that anymore, it's not that simple anymore.
+ StackLock lock(_mutex);
for (int i = 0; i != NUM_CHANNELS; i++)
if (_channels[i] && !_channels[i]->isMusicChannel())
return true;
@@ -350,6 +353,7 @@
}
bool SoundMixer::isActiveChannel(int index) {
+ StackLock lock(_mutex);
if (_channels[index])
return _channels[index]->isActive();
return false;
More information about the Scummvm-git-logs
mailing list