diff options
author | Willem Jan Palenstijn | 2009-03-01 12:08:44 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2009-03-01 12:08:44 +0000 |
commit | 82e4168d47488f88330a05ba11f376d27ecc6035 (patch) | |
tree | 52c17cc09d398342ac7e835d1a50af461c9bcf34 /engines/sci/sfx | |
parent | 3429c17ac457bcff59f47dc68d2a11f4d1b48308 (diff) | |
download | scummvm-rg350-82e4168d47488f88330a05ba11f376d27ecc6035.tar.gz scummvm-rg350-82e4168d47488f88330a05ba11f376d27ecc6035.tar.bz2 scummvm-rg350-82e4168d47488f88330a05ba11f376d27ecc6035.zip |
Don't free a sfx_pcm_feed_t that's still in use.
It's a rather hackish fix, but this feed-wrapping code should only be
temporary anyway.
svn-id: r39033
Diffstat (limited to 'engines/sci/sfx')
-rw-r--r-- | engines/sci/sfx/mixer.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/engines/sci/sfx/mixer.cpp b/engines/sci/sfx/mixer.cpp index 517d53d446..09441f9ab6 100644 --- a/engines/sci/sfx/mixer.cpp +++ b/engines/sci/sfx/mixer.cpp @@ -190,7 +190,8 @@ PCMFeedState::PCMFeedState(sfx_pcm_feed_t *f) : feed(f) { } PCMFeedState::~PCMFeedState() { - feed->destroy(feed); + if (feed) + feed->destroy(feed); free(buf); } @@ -231,6 +232,12 @@ static void mix_subscribe(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed) { P->_feeds.push_back(fs); + // HACK: the copy of fs made in P->_feeds is a shallow copy, + // so we need to prevent fs.buf and fs.feed from being destroyed when + // fs goes out of scope + fs.buf = 0; + fs.feed = 0; + RELEASE_LOCK(); } |