From 46bcd3b5e9709bfc0bcd32b8db3cc337e46e409a Mon Sep 17 00:00:00 2001 From: athrxx Date: Fri, 21 Oct 2011 22:24:59 +0200 Subject: [PATCH] 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(). --- engines/sci/engine/savegame.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp index c30518ab42a..030c0f3f54e 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);