diff --git a/BizHawk.Emulation.Common/Sound/Utilities/SpeexResampler.cs b/BizHawk.Emulation.Common/Sound/Utilities/SpeexResampler.cs index 3edc4aa6ff..c1a5974721 100644 --- a/BizHawk.Emulation.Common/Sound/Utilities/SpeexResampler.cs +++ b/BizHawk.Emulation.Common/Sound/Utilities/SpeexResampler.cs @@ -400,8 +400,17 @@ namespace BizHawk.Emulation.Common public void Dispose() { - LibSpeexDSP.speex_resampler_destroy(st); - st = IntPtr.Zero; + if (st != IntPtr.Zero) + { + LibSpeexDSP.speex_resampler_destroy(st); + st = IntPtr.Zero; + GC.SuppressFinalize(this); + } + } + + ~SpeexResampler() + { + Dispose(); } void InternalDrain(short[] buf, int nsamp)