Merge pull request #186 from thefiddler/al_notfound_fix
[AL] Fix runtime crash when OpenAL not available
This commit is contained in:
commit
9a37b72002
1 changed files with 16 additions and 6 deletions
|
@ -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