SKY: Try to avoid deadlocks with the mixer mutex.

See bug #3512069.
This commit is contained in:
Alyssa Milburn 2013-05-29 09:04:44 +02:00
parent f055512f17
commit b16f2d8405

View File

@ -44,9 +44,9 @@ MusicBase::~MusicBase() {
}
void MusicBase::loadSection(uint8 pSection) {
Common::StackLock lock(_mutex);
if (_currentMusic)
stopMusicInternal();
Common::StackLock lock(_mutex);
free(_musicData);
_currentSection = pSection;
_musicData = _skyDisk->loadFile(_driverFileBase + FILES_PER_SECTION * pSection);
@ -70,13 +70,14 @@ bool MusicBase::musicIsPlaying() {
}
void MusicBase::stopMusic() {
Common::StackLock lock(_mutex);
stopMusicInternal();
}
void MusicBase::stopMusicInternal() {
_mixer->stopHandle(_musicHandle);
Common::StackLock lock(_mutex);
for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++)
delete _channels[cnt];
_numberOfChannels = 0;