Ticket #9104: 0001-SCI-sfx-fix-iterators-from-not-getting-freed-when-th.patch

File 0001-SCI-sfx-fix-iterators-from-not-getting-freed-when-th.patch, 1.1 KB (added by SF/lwalkera, 14 years ago)

The patch

  • engines/sci/sfx/core.cpp

    From da4d62e205afceb06c46c2d3cfe465a147d18955 Mon Sep 17 00:00:00 2001
    From: Laine Walker-Avina <lwalkera@ieee.org>
    Date: Tue, 3 Nov 2009 01:49:12 -0800
    Subject: [PATCH 1/2] SCI sfx: fix iterators from not getting freed when there's only one song left playing
    
    ---
     engines/sci/sfx/core.cpp |    8 +++++++-
     1 files changed, 7 insertions(+), 1 deletions(-)
    
    diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp
    index acc89f6..fd28193 100644
    a b void SfxState::updateMultiSong() {  
    566566
    567567        // WORKAROUND: sometimes, newsong can be NULL (e.g. in SQ4).
    568568        // Handle this here, so that we avoid a crash
    569         if (!newsong)
     569        if (!newsong) {
     570                if(oldfirst && oldfirst->_status == SOUND_STATUS_STOPPED) {
     571                        debugC(2, kDebugLevelSound, "[SFX] Stopping song %lx\n", oldfirst->_handle);
     572                        if (_player && oldfirst->_it)
     573                                _player->iterator_message(SongIterator::Message(oldfirst->_it->ID, SIMSG_STOP));
     574                }
    570575                return;
     576        }
    571577
    572578        for (newseeker = newsong; newseeker;
    573579                newseeker = newseeker->_nextPlaying) {