avoid race condition on StreamingSound.Dispose

pull/52/head
cosmonaut 2023-12-13 13:58:55 -08:00
parent baef5d3ed9
commit 1cdcdab148
1 changed files with 8 additions and 5 deletions

View File

@ -149,6 +149,8 @@ namespace MoonWorks.Audio
protected override unsafe void Dispose(bool disposing) protected override unsafe void Dispose(bool disposing)
{ {
if (!IsDisposed) if (!IsDisposed)
{
lock (StateLock)
{ {
Stop(); Stop();
@ -160,6 +162,7 @@ namespace MoonWorks.Audio
} }
} }
} }
}
base.Dispose(disposing); base.Dispose(disposing);
} }
} }