mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-11 03:34:13 +00:00
SCUMM: (MI1/Mac) - fix mem leak
This commit is contained in:
parent
6fb06a0bbc
commit
a679820502
@ -40,6 +40,8 @@ namespace Scumm {
|
||||
class MacSndChannel {
|
||||
public:
|
||||
MacSndChannel(MacLowLevelPCMDriver *drv, Audio::Mixer::SoundType sndtp, int synth, bool interp, bool enableL, bool enableR, MacLowLevelPCMDriver::ChanCallback *callback);
|
||||
~MacSndChannel();
|
||||
|
||||
MacLowLevelPCMDriver::ChanHandle getHandle() const;
|
||||
|
||||
void playSamples(const MacLowLevelPCMDriver::PCMSound *snd);
|
||||
@ -515,6 +517,10 @@ MacSndChannel::MacSndChannel(MacLowLevelPCMDriver *drv, Audio::Mixer::SoundType
|
||||
}
|
||||
}
|
||||
|
||||
MacSndChannel::~MacSndChannel() {
|
||||
flush();
|
||||
}
|
||||
|
||||
MacLowLevelPCMDriver::ChanHandle MacSndChannel::getHandle() const {
|
||||
const void *ptr = this;
|
||||
return *reinterpret_cast<const int*>(&ptr);
|
||||
@ -557,6 +563,12 @@ void MacSndChannel::wait(uint32 duration) {
|
||||
}
|
||||
|
||||
void MacSndChannel::flush() {
|
||||
for (Common::Array<SoundCommand>::const_iterator i = _sndCmdQueue.begin(); i != _sndCmdQueue.end(); ++i) {
|
||||
if (i->ptr && i->arg2 == 1)
|
||||
delete reinterpret_cast<MacLowLevelPCMDriver::PCMSound*>(i->ptr);
|
||||
else if (i->ptr && i->arg2 == 2)
|
||||
delete[] reinterpret_cast<byte*>(i->ptr);
|
||||
}
|
||||
_sndCmdQueue.clear();
|
||||
_tmrInc = 0;
|
||||
_duration = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user