From af3d1237300c983da6733e0ff118414d7883367e Mon Sep 17 00:00:00 2001 From: Paweł Kołodziejski Date: Sun, 20 Jun 2004 20:13:01 +0000 Subject: added exception for insane sounds to prevent deadlock svn-id: r13983 --- scumm/imuse_digi/dimuse_script.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scumm/imuse_digi/dimuse_script.cpp b/scumm/imuse_digi/dimuse_script.cpp index d6b4918855..2209ff023c 100644 --- a/scumm/imuse_digi/dimuse_script.cpp +++ b/scumm/imuse_digi/dimuse_script.cpp @@ -163,19 +163,23 @@ void IMuseDigital::flushTracks() { debug(5, "flushTracks()"); for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) { Track *track = _track[l]; - if (track->used && track->readyToRemove) { - if (track->stream) { + if (track->used && + (track->readyToRemove || (!_vm->_videoFinished && track->toBeRemoved))) { + if ((track->stream) && (!track->stream->endOfStream())) { track->stream->finish(); - track->stream = NULL; + } else if ((track->stream) && (track->stream->endOfStream())) { _vm->_mixer->stopHandle(track->handle); + delete track->stream; + track->stream = NULL; _sound->closeSound(track->soundHandle); track->soundHandle = NULL; + track->used = false; } else if (track->stream2) { _vm->_mixer->stopHandle(track->handle); delete track->stream2; track->stream2 = NULL; + track->used = false; } - track->used = false; } } } @@ -385,4 +389,3 @@ void IMuseDigital::pause(bool p) { } } // End of namespace Scumm - -- cgit v1.2.3