From f5e7833adb3cd0fe38905f3dd4fc1374edf8b043 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 18 Jan 2007 07:28:51 +0000 Subject: [PATCH] Don't lock while calling SOUNDMAN driver calls (mutex ordering requirement). --- stepmania/src/RageSound.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index a54b6ae369..638fcca3cb 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -108,11 +108,11 @@ RageSound &RageSound::operator=( const RageSound &cpy ) void RageSound::Unload() { - LockMut(m_Mutex); - - if(IsPlaying()) + if( IsPlaying() ) StopPlaying(); + LockMut(m_Mutex); + delete m_pSource; m_pSource = NULL; @@ -326,6 +326,9 @@ void RageSound::StartPlaying() m_Param.m_Volume = 0; ApplyParams(); + /* Don't lock while calling SOUNDMAN driver calls. */ + ASSERT( !m_Mutex.IsLockedByThisThread() ); + SOUNDMAN->StartMixing( this ); // LOG->Trace("StartPlaying %p finished (%s)", this, this->GetLoadedFilePath().c_str()); @@ -333,6 +336,9 @@ void RageSound::StartPlaying() void RageSound::StopPlaying() { + /* Don't lock while calling SOUNDMAN driver calls. */ + ASSERT( !m_Mutex.IsLockedByThisThread() ); + /* Tell the sound driver to stop mixing this sound. */ SOUNDMAN->StopMixing(this); }