diff options
author | Filippos Karapetis | 2010-01-04 14:43:14 +0000 |
---|---|---|
committer | Filippos Karapetis | 2010-01-04 14:43:14 +0000 |
commit | d437b25c5774261f727a2e91f8e1b6a200ca5d4a (patch) | |
tree | 608e6aee9b61c620063a7c547d141f2e9cd3bcb4 /engines | |
parent | 60ece55fb97eb9cd18a4803df174f2a28de55a86 (diff) | |
download | scummvm-rg350-d437b25c5774261f727a2e91f8e1b6a200ca5d4a.tar.gz scummvm-rg350-d437b25c5774261f727a2e91f8e1b6a200ca5d4a.tar.bz2 scummvm-rg350-d437b25c5774261f727a2e91f8e1b6a200ca5d4a.zip |
SCI/new music: Resolved another possible deadlock when pausing all sounds
svn-id: r46971
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/sfx/soundcmd.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/engines/sci/sfx/soundcmd.cpp b/engines/sci/sfx/soundcmd.cpp index e22d24fa18..18c6ca5da2 100644 --- a/engines/sci/sfx/soundcmd.cpp +++ b/engines/sci/sfx/soundcmd.cpp @@ -529,20 +529,24 @@ 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; + MusicList::iterator listEnd = NULL; if (!obj.segment) { // Pausing/Resuming the whole playlist was introduced // in the SCI1 late sound scheme if (_soundVersion <= SCI_VERSION_1_EARLY) return; + _music->_mutex.lock(); slotLoop = _music->getPlayListStart(); + listEnd = _music->getPlayListEnd(); musicSlot = *slotLoop; + _music->_mutex.unlock(); } else { + _music->_mutex.lock(); musicSlot = _music->getSlot(obj); + _music->_mutex.unlock(); if (!musicSlot) { warning("cmdPauseSound: Slot not found (%04x:%04x)", PRINT_REG(obj)); return; @@ -561,10 +565,13 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) { } if (slotLoop) { - if (slotLoop == _music->getPlayListEnd()) + if (slotLoop == listEnd) { break; - else + } else { + _music->_mutex.lock(); musicSlot = *(slotLoop++); + _music->_mutex.unlock(); + } } } while (slotLoop); |