[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
1 changed files with 16 additions and 6 deletions
|
@ -204,6 +204,10 @@ namespace OpenTK.Audio
|
|||
{
|
||||
Debug.Unindent();
|
||||
|
||||
if (openal_supported)
|
||||
{
|
||||
try
|
||||
{
|
||||
// clean up the dummy context
|
||||
Alc.MakeContextCurrent(ContextHandle.Zero);
|
||||
if (dummy_context != ContextHandle.Zero && dummy_context.Handle != IntPtr.Zero)
|
||||
|
@ -211,6 +215,12 @@ namespace OpenTK.Audio
|
|||
if (dummy_device != IntPtr.Zero)
|
||||
Alc.CloseDevice(dummy_device);
|
||||
}
|
||||
catch
|
||||
{
|
||||
openal_supported = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
Loading…
Reference in a new issue