Try and make alcDestroyContext more resilient

This commit is contained in:
Joshua Granick
2018-09-13 22:02:02 -07:00
parent a4dda159f1
commit b808c61113

View File

@@ -3186,7 +3186,19 @@ namespace lime {
al_gc_mutex.Lock ();
ALCcontext* alcContext = (ALCcontext*)val_data (context);
alcObjects.erase (alcContext);
if (alcObjects.find (alcContext) != alcObjects.end ()) {
alcObjects.erase (alcContext);
}
if (alcContext == alcGetCurrentContext ()) {
alcMakeContextCurrent (0);
}
alcDestroyContext (alcContext);
al_gc_mutex.Unlock ();
@@ -3197,7 +3209,19 @@ namespace lime {
al_gc_mutex.Lock ();
ALCcontext* alcContext = (ALCcontext*)context->ptr;
alcObjects.erase (alcContext);
if (alcObjects.find (alcContext) != alcObjects.end ()) {
alcObjects.erase (alcContext);
}
if (alcContext == alcGetCurrentContext ()) {
alcMakeContextCurrent (0);
}
alcDestroyContext (alcContext);
al_gc_mutex.Unlock ();