From 2bc0ffdeb7734b4165a0426b3e533e477a5b0d0d Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 2 Jan 2010 13:57:36 +0000 Subject: SCI/new music code: hopefully fixed a race condition svn-id: r46882 --- engines/sci/sfx/soundcmd.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'engines') diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index e7aa84d915..1707eae08c 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -514,7 +514,6 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) { changeSoundStatus(obj, value ? SOUND_STATUS_SUSPENDED : SOUND_STATUS_PLAYING); #else - Common::StackLock lock(_music->_mutex); MusicEntry *musicSlot = NULL; MusicList::iterator slotLoop = NULL; @@ -533,6 +532,8 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) { } } + Common::StackLock lock(_music->_mutex); + do { if (_soundVersion <= SCI_VERSION_0_LATE) { PUT_SEL32V(_segMan, musicSlot->soundObj, state, kSoundPaused); @@ -551,6 +552,7 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) { musicSlot = *(slotLoop++); } } while (slotLoop); + #endif } @@ -759,14 +761,11 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { PUT_SEL32V(_segMan, obj, frame, frame); } #else - _music->_mutex.lock(); MusicEntry *musicSlot = _music->getSlot(obj); if (!musicSlot) { warning("cmdUpdateCues: Slot not found (%04x:%04x)", PRINT_REG(obj)); - _music->_mutex.unlock(); return; } - _music->_mutex.unlock(); // unlock to perform mixer-related calls // In SCI0, make absolutely sure that the sound object hasn't // been deleted (can happen e.g. at the ending of QFG1) @@ -799,8 +798,6 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { } } - _music->_mutex.lock(); // and lock again - switch (musicSlot->signal) { case 0: if (musicSlot->dataInc != GET_SEL32V(_segMan, obj, dataInc)) { @@ -834,7 +831,6 @@ void SoundCommandParser::cmdUpdateCues(reg_t obj, int16 value) { PUT_SEL32V(_segMan, obj, frame, musicSlot->ticker); } - _music->_mutex.unlock(); #endif } -- cgit v1.2.3