From 6ea1cf73769a17a556588347e9177e49960bff6f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 4 Nov 2009 15:51:50 +0000 Subject: Applied patch #2891230 - "SCI sfx: fix song iterators from not getting freed" svn-id: r45670 --- engines/sci/sfx/core.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'engines/sci') diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp index b121d1d877..16f414affe 100644 --- a/engines/sci/sfx/core.cpp +++ b/engines/sci/sfx/core.cpp @@ -561,8 +561,15 @@ void SfxState::updateMultiSong() { // WORKAROUND: sometimes, newsong can be NULL (e.g. in SQ4). // Handle this here, so that we avoid a crash - if (!newsong) + if (!newsong) { + // Iterators should get freed when there's only one song left playing + if(oldfirst && oldfirst->_status == SOUND_STATUS_STOPPED) { + debugC(2, kDebugLevelSound, "[SFX] Stopping song %lx\n", oldfirst->_handle); + if (_player && oldfirst->_it) + _player->iterator_message(SongIterator::Message(oldfirst->_it->ID, SIMSG_STOP)); + } return; + } for (newseeker = newsong; newseeker; newseeker = newseeker->_nextPlaying) { -- cgit v1.2.3