From dd3cb33c9f43412617e2b2b76d9e2a4dec9a2a23 Mon Sep 17 00:00:00 2001
From: gdkchan <gab.dark.100@gmail.com>
Date: Fri, 12 Oct 2018 18:47:53 -0300
Subject: [PATCH] Fix race condition on OpenALAudioOut (#448)

---
 Ryujinx.Audio/OpenAL/OpenALAudioOut.cs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs b/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs
index d7a2a77751..9a75c5685e 100644
--- a/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs
+++ b/Ryujinx.Audio/OpenAL/OpenALAudioOut.cs
@@ -182,7 +182,10 @@ namespace Ryujinx.Audio.OpenAL
             {
                 foreach (Track Td in Tracks.Values)
                 {
-                    Td.CallReleaseCallbackIfNeeded();
+                    lock (Td)
+                    {
+                        Td.CallReleaseCallbackIfNeeded();
+                    }
                 }
 
                 //If it's not slept it will waste cycles.