From 80059b308b7ca0b727d37d257977aef251fa71b7 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 23 Dec 2006 10:27:21 +0000 Subject: [PATCH] fix possible lock order problem --- stepmania/src/RageSound.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index 0ef08efcd2..4ec72c6396 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -367,10 +367,14 @@ void RageSound::SoundIsFinishedPlaying() { if( !m_bPlaying ) return; - m_Mutex.Lock(); + /* Lock the mutex after calling UnregisterPlayingSound. We must not make driver + * calls with our mutex locked (driver mutex < sound mutex). Nobody else will + * see our sound as not playing until we set playing to false. */ m_iStoppedSourceFrame = (int) GetPositionSecondsInternal(); + m_Mutex.Lock(); + // LOG->Trace("set playing false for %p (SoundIsFinishedPlaying) (%s)", this, this->GetLoadedFilePath().c_str()); m_bPlaying = false;