From f8c72439383c6ea6324d03fa4c9e067a33af2235 Mon Sep 17 00:00:00 2001 From: Martin Kiewitz Date: Tue, 19 Oct 2010 14:53:39 +0000 Subject: SCI: fixing possible deadlock inside clearPlaylist thx to ajax16384 svn-id: r53613 --- engines/sci/sound/music.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 0dfa02c83f..252ea5489c 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -158,8 +158,10 @@ void SciMusic::sendMidiCommandsFromQueue() { } void SciMusic::clearPlayList() { - Common::StackLock lock(_mutex); - + // we must NOT lock our mutex here. Playlist is modified inside soundKill() which will lock the mutex + // during deletion. If we lock it here, a deadlock may occur within soundStop() because that one + // calls the mixer, which will also lock the mixer mutex and if the mixer thread is active during + // that time, we will get a deadlock. while (!_playList.empty()) { soundStop(_playList[0]); soundKill(_playList[0]); -- cgit v1.2.3