aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorathrxx2011-10-21 22:24:59 +0200
committerathrxx2011-10-22 19:53:24 +0200
commitda96afe167a62663c24323062b353347454f09e9 (patch)
tree5e6fd17956d587bff4e86424e7bc787211fa3f31
parentd8e50b8a037de7f721491664610682f1076ca9ea (diff)
downloadscummvm-rg350-da96afe167a62663c24323062b353347454f09e9.tar.gz
scummvm-rg350-da96afe167a62663c24323062b353347454f09e9.tar.bz2
scummvm-rg350-da96afe167a62663c24323062b353347454f09e9.zip
SCI: fix thread lockup issue when loading savegames using a sound driver which depends on the mixer thread for timer calls.
The issues seems to be known. See comments (not by me) in SciMusic::clearPlayList(). For the same reason mentioned there the mutex may also not be locked before calling clearPlayList().
-rw-r--r--engines/sci/engine/savegame.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index c30518ab42..030c0f3f54 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -545,8 +545,6 @@ void DataStack::saveLoadWithSerializer(Common::Serializer &s) {
void SciMusic::saveLoadWithSerializer(Common::Serializer &s) {
// Sync song lib data. When loading, the actual song lib will be initialized
// afterwards in gamestate_restore()
- Common::StackLock lock(_mutex);
-
int songcount = 0;
byte masterVolume = soundGetMasterVolume();
byte reverb = _pMidiDrv->getReverb();
@@ -576,9 +574,12 @@ void SciMusic::saveLoadWithSerializer(Common::Serializer &s) {
songcount = _playList.size();
s.syncAsUint32LE(songcount);
- if (s.isLoading()) {
+ if (s.isLoading())
clearPlayList();
+ Common::StackLock lock(_mutex);
+
+ if (s.isLoading()) {
for (int i = 0; i < songcount; i++) {
MusicEntry *curSong = new MusicEntry();
curSong->saveLoadWithSerializer(s);