[Scummvm-git-logs] scummvm master -> ebd0d0956bec5a7d93cd34f9a9028d75e856d1aa
bluegr
noreply at scummvm.org
Wed Nov 16 23:01:00 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ebd0d0956b BBVS: Fix memory leak in audio code
Commit: ebd0d0956bec5a7d93cd34f9a9028d75e856d1aa
https://github.com/scummvm/scummvm/commit/ebd0d0956bec5a7d93cd34f9a9028d75e856d1aa
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-11-17T01:00:56+02:00
Commit Message:
BBVS: Fix memory leak in audio code
Changed paths:
engines/bbvs/sound.cpp
diff --git a/engines/bbvs/sound.cpp b/engines/bbvs/sound.cpp
index bb685ffec92..13f6b4dcdd0 100644
--- a/engines/bbvs/sound.cpp
+++ b/engines/bbvs/sound.cpp
@@ -48,11 +48,18 @@ void Sound::load(const Common::String &filename) {
void Sound::play(bool loop) {
debug(0, "Sound::play() [%s] loop:%d", _filename.c_str(), loop);
+
stop();
_stream->rewind();
- Audio::AudioStream *audioStream = Audio::makeLoopingAudioStream(_stream, loop ? 0 : 1);
- g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_handle, audioStream,
- -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+
+ if (loop) {
+ Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(_stream, 0, DisposeAfterUse::NO);
+ g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_handle, audioStream,
+ -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::YES);
+ } else {
+ g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, &_handle, _stream,
+ -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+ }
}
void Sound::stop() {
More information about the Scummvm-git-logs
mailing list