aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2016-10-08 22:32:13 +0200
committerWillem Jan Palenstijn2016-10-08 22:32:13 +0200
commit379e3b80daea93a375a752dd582aa42830054e18 (patch)
tree808270360afb3f79f26774723bdec89df5a14488 /engines/sci
parentc0b76581d8e4c1938c3f2f617edf553105dc6fdc (diff)
downloadscummvm-rg350-379e3b80daea93a375a752dd582aa42830054e18.tar.gz
scummvm-rg350-379e3b80daea93a375a752dd582aa42830054e18.tar.bz2
scummvm-rg350-379e3b80daea93a375a752dd582aa42830054e18.zip
SCI: Release SCI music mutex earlier in reconstructPlayList
This avoids a deadlock where the main thread (via reconstructPlayList) tries to acquire the mixer lock (in soundPlay) while holding the SCI music lock, and the audio thread is holding the mixer lock and tries to acquire the SCI music lock (in miditimerCallback). Bug #6691.
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/savegame.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index 20889f230b..f01e2a677e 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -632,13 +632,16 @@ void SoundCommandParser::syncPlayList(Common::Serializer &s) {
}
void SoundCommandParser::reconstructPlayList() {
- Common::StackLock lock(_music->_mutex);
+ _music->_mutex.lock();
// We store all songs here because starting songs may re-shuffle their order
MusicList songs;
for (MusicList::iterator i = _music->getPlayListStart(); i != _music->getPlayListEnd(); ++i)
songs.push_back(*i);
+ // Done with main playlist, so release lock
+ _music->_mutex.unlock();
+
for (MusicList::iterator i = songs.begin(); i != songs.end(); ++i) {
initSoundResource(*i);