SCI/new music: Resolved another possible deadlock when pausing all sounds
svn-id: r46971
This commit is contained in:
parent
60ece55fb9
commit
d437b25c57
1 changed files with 11 additions and 4 deletions
|
@ -529,20 +529,24 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) {
|
||||||
changeSoundStatus(obj, value ? SOUND_STATUS_SUSPENDED : SOUND_STATUS_PLAYING);
|
changeSoundStatus(obj, value ? SOUND_STATUS_SUSPENDED : SOUND_STATUS_PLAYING);
|
||||||
#else
|
#else
|
||||||
|
|
||||||
Common::StackLock lock(_music->_mutex);
|
|
||||||
|
|
||||||
MusicEntry *musicSlot = NULL;
|
MusicEntry *musicSlot = NULL;
|
||||||
MusicList::iterator slotLoop = NULL;
|
MusicList::iterator slotLoop = NULL;
|
||||||
|
MusicList::iterator listEnd = NULL;
|
||||||
|
|
||||||
if (!obj.segment) {
|
if (!obj.segment) {
|
||||||
// Pausing/Resuming the whole playlist was introduced
|
// Pausing/Resuming the whole playlist was introduced
|
||||||
// in the SCI1 late sound scheme
|
// in the SCI1 late sound scheme
|
||||||
if (_soundVersion <= SCI_VERSION_1_EARLY)
|
if (_soundVersion <= SCI_VERSION_1_EARLY)
|
||||||
return;
|
return;
|
||||||
|
_music->_mutex.lock();
|
||||||
slotLoop = _music->getPlayListStart();
|
slotLoop = _music->getPlayListStart();
|
||||||
|
listEnd = _music->getPlayListEnd();
|
||||||
musicSlot = *slotLoop;
|
musicSlot = *slotLoop;
|
||||||
|
_music->_mutex.unlock();
|
||||||
} else {
|
} else {
|
||||||
|
_music->_mutex.lock();
|
||||||
musicSlot = _music->getSlot(obj);
|
musicSlot = _music->getSlot(obj);
|
||||||
|
_music->_mutex.unlock();
|
||||||
if (!musicSlot) {
|
if (!musicSlot) {
|
||||||
warning("cmdPauseSound: Slot not found (%04x:%04x)", PRINT_REG(obj));
|
warning("cmdPauseSound: Slot not found (%04x:%04x)", PRINT_REG(obj));
|
||||||
return;
|
return;
|
||||||
|
@ -561,10 +565,13 @@ void SoundCommandParser::cmdPauseSound(reg_t obj, int16 value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slotLoop) {
|
if (slotLoop) {
|
||||||
if (slotLoop == _music->getPlayListEnd())
|
if (slotLoop == listEnd) {
|
||||||
break;
|
break;
|
||||||
else
|
} else {
|
||||||
|
_music->_mutex.lock();
|
||||||
musicSlot = *(slotLoop++);
|
musicSlot = *(slotLoop++);
|
||||||
|
_music->_mutex.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (slotLoop);
|
} while (slotLoop);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue