mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-05-08 15:12:09 +00:00
[AL] Fix runtime crash when OpenAL not available
Issue reported at http://www.opentk.com/node/3805 We must not throw exceptions from a finalizer, as this leads to the runtime forcibly taking down the application.
This commit is contained in:
parent
e06fc9fb0a
commit
9851a3bab9
|
@ -204,12 +204,22 @@ namespace OpenTK.Audio
|
||||||
{
|
{
|
||||||
Debug.Unindent();
|
Debug.Unindent();
|
||||||
|
|
||||||
// clean up the dummy context
|
if (openal_supported)
|
||||||
Alc.MakeContextCurrent(ContextHandle.Zero);
|
{
|
||||||
if (dummy_context != ContextHandle.Zero && dummy_context.Handle != IntPtr.Zero)
|
try
|
||||||
Alc.DestroyContext(dummy_context);
|
{
|
||||||
if (dummy_device != IntPtr.Zero)
|
// clean up the dummy context
|
||||||
Alc.CloseDevice(dummy_device);
|
Alc.MakeContextCurrent(ContextHandle.Zero);
|
||||||
|
if (dummy_context != ContextHandle.Zero && dummy_context.Handle != IntPtr.Zero)
|
||||||
|
Alc.DestroyContext(dummy_context);
|
||||||
|
if (dummy_device != IntPtr.Zero)
|
||||||
|
Alc.CloseDevice(dummy_device);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
openal_supported = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue