diff options
author | Joost Peters | 2003-10-24 23:09:01 +0000 |
---|---|---|
committer | Joost Peters | 2003-10-24 23:09:01 +0000 |
commit | 3ad14b06f507d056da5c8e1506d95e607029f75e (patch) | |
tree | 3c96bd8a3e8555b522a85df4d327f3837ebaa410 /sound/mixer.cpp | |
parent | 87e1963cffd79cbd5aed472f58a91a9ae973c13d (diff) | |
download | scummvm-rg350-3ad14b06f507d056da5c8e1506d95e607029f75e.tar.gz scummvm-rg350-3ad14b06f507d056da5c8e1506d95e607029f75e.tar.bz2 scummvm-rg350-3ad14b06f507d056da5c8e1506d95e607029f75e.zip |
added extra flag to mixer so we don't use free() on new'd pointers
svn-id: r10958
Diffstat (limited to 'sound/mixer.cpp')
-rw-r--r-- | sound/mixer.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp index a46ad18db7..21439a648e 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -44,6 +44,7 @@ protected: RateConverter *_converter; AudioInputStream *_input; byte _volume; + byte _flags; int8 _pan; bool _paused; @@ -510,6 +511,7 @@ ChannelRaw::ChannelRaw(SoundMixer *mixer, PlayingSoundHandle *handle, void *soun : Channel(mixer, handle) { _id = id; _ptr = (byte *)sound; + _flags = flags; _volume = volume; _pan = pan; @@ -533,7 +535,10 @@ ChannelRaw::ChannelRaw(SoundMixer *mixer, PlayingSoundHandle *handle, void *soun } ChannelRaw::~ChannelRaw() { - free(_ptr); + if (_flags & SoundMixer::FLAG_AUTOFREE) + free(_ptr); + else if (_flags & SoundMixer::FLAG_AUTODELETE) + delete _ptr; } ChannelStream::ChannelStream(SoundMixer *mixer, PlayingSoundHandle *handle, |