aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2009-11-04 15:51:50 +0000
committerFilippos Karapetis2009-11-04 15:51:50 +0000
commit6ea1cf73769a17a556588347e9177e49960bff6f (patch)
treee22768b3fd40aa49fa0f5afc9223097508cd1794 /engines
parentd2b76368e11edaea60bcbbd40a2195a38eb0d586 (diff)
downloadscummvm-rg350-6ea1cf73769a17a556588347e9177e49960bff6f.tar.gz
scummvm-rg350-6ea1cf73769a17a556588347e9177e49960bff6f.tar.bz2
scummvm-rg350-6ea1cf73769a17a556588347e9177e49960bff6f.zip
Applied patch #2891230 - "SCI sfx: fix song iterators from not getting freed"
svn-id: r45670
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/sfx/core.cpp9
1 files changed, 8 insertions, 1 deletions
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) {