From be4b5cf2c70cf0ea594f8baa9a0abb0cc774f23f Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 20 Apr 2022 14:57:24 -0700 Subject: [PATCH] fix audio not being disposed in correct order --- src/Audio/AudioDevice.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Audio/AudioDevice.cs b/src/Audio/AudioDevice.cs index 9dbb52be..16a5c492 100644 --- a/src/Audio/AudioDevice.cs +++ b/src/Audio/AudioDevice.cs @@ -240,16 +240,16 @@ namespace MoonWorks.Audio { if (disposing) { - for (var i = streamingSounds.Count - 1; i >= 0; i--) + for (var i = resources.Count - 1; i >= 0; i--) { - var weakReference = streamingSounds[i]; + var weakReference = resources[i]; - if (weakReference.TryGetTarget(out var streamingSound)) + if (weakReference.TryGetTarget(out var resource)) { - streamingSound.Dispose(); + resource.Dispose(); } } - streamingSounds.Clear(); + resources.Clear(); } FAudio.FAudioVoice_DestroyVoice(ReverbVoice);