From 528fb7ac7cf99408ebe86dba7387ef994eab7a9f Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Fri, 8 Dec 2023 15:06:17 -0800 Subject: [PATCH] fix potential heap corruption on audio shutdown --- src/Audio/AudioDevice.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Audio/AudioDevice.cs b/src/Audio/AudioDevice.cs index dea4edc7..17f617e8 100644 --- a/src/Audio/AudioDevice.cs +++ b/src/Audio/AudioDevice.cs @@ -292,16 +292,16 @@ namespace MoonWorks.Audio { Thread.Join(); - // stop all source voices + // dispose all voices first foreach (var resource in resources) { - if (resource.Target is SourceVoice voice) + if (resource.Target is Voice voice) { - voice.Stop(); + voice.Dispose(); } } - // destroy all audio resources + // destroy all other audio resources foreach (var resource in resources) { if (resource.Target is IDisposable disposable)