[Scummvm-cvs-logs] SF.net SVN: scummvm:[46882] scummvm/trunk/engines/sci/sfx/soundcmd.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Jan 2 14:57:36 CET 2010


Revision: 46882
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46882&view=rev
Author:   thebluegr
Date:     2010-01-02 13:57:36 +0000 (Sat, 02 Jan 2010)

Log Message:
-----------
SCI/new music code: hopefully fixed a race condition

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sfx/soundcmd.cpp

Modified: scummvm/trunk/engines/sci/sfx/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2010-01-02 13:36:12 UTC (rev 46881)
+++ scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2010-01-02 13:57:36 UTC (rev 46882)
@@ -514,7 +514,6 @@
 		changeSoundStatus(obj, value ? SOUND_STATUS_SUSPENDED : SOUND_STATUS_PLAYING);
 #else
 
-	Common::StackLock lock(_music->_mutex);
 	MusicEntry *musicSlot = NULL;
 	MusicList::iterator slotLoop = NULL;
 
@@ -533,6 +532,8 @@
 		}
 	}
 
+	Common::StackLock lock(_music->_mutex);
+
 	do {
 		if (_soundVersion <= SCI_VERSION_0_LATE) {
 			PUT_SEL32V(_segMan, musicSlot->soundObj, state, kSoundPaused);
@@ -551,6 +552,7 @@
 				musicSlot = *(slotLoop++);
 		}
 	} while (slotLoop);
+
 #endif
 }
 
@@ -759,14 +761,11 @@
 		PUT_SEL32V(_segMan, obj, frame, frame);
 	}
 #else
-	_music->_mutex.lock();
 	MusicEntry *musicSlot = _music->getSlot(obj);
 	if (!musicSlot) {
 		warning("cmdUpdateCues: Slot not found (%04x:%04x)", PRINT_REG(obj));
-		_music->_mutex.unlock();
 		return;
 	}
-	_music->_mutex.unlock();	// unlock to perform mixer-related calls
 
 	// In SCI0, make absolutely sure that the sound object hasn't
 	// been deleted (can happen e.g. at the ending of QFG1)
@@ -799,8 +798,6 @@
 		}
 	}
 
-	_music->_mutex.lock();	// and lock again
-
 	switch (musicSlot->signal) {
 		case 0:
 			if (musicSlot->dataInc != GET_SEL32V(_segMan, obj, dataInc)) {
@@ -834,7 +831,6 @@
 		PUT_SEL32V(_segMan, obj, frame, musicSlot->ticker);
 	}
 
-	_music->_mutex.unlock();
 #endif
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list