OpenALBindings: Avoid deadlock when Sys.exit() is called
This change eliminates the cleanup attempt of the current OpenAL context and associated system resources. A change in OpenAL 1.20.0 made it unlikely that we will be able to clean up things in this way moving forward. We should steer users toward using `lime.system.System.exit()` or petition a change in the haxe stdlib to allow us to hook into Sys.exit(). I am not 100% satisfied with this, so perhaps we will find another solution. In the end, I think the benefit of updating OpenAL supersedes any inconvenience here. Closes https://github.com/openfl/lime/issues/1803
This commit is contained in:
@@ -142,7 +142,12 @@ namespace lime {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*This has been removed after updating to openal 1.20.0+ since the cleanup functions involved
|
||||||
|
* lead to deadlocking. See https://github.com/openfl/lime/issues/1803 for more info.
|
||||||
|
* Developers should use lime.system.System.exit() instead of Sys.exit() to clean up any system
|
||||||
|
* resources
|
||||||
|
*/
|
||||||
|
/*
|
||||||
void lime_al_atexit () {
|
void lime_al_atexit () {
|
||||||
|
|
||||||
ALCcontext* alcContext = alcGetCurrentContext ();
|
ALCcontext* alcContext = alcGetCurrentContext ();
|
||||||
@@ -163,7 +168,7 @@ namespace lime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void lime_al_auxf (value aux, int param, float value) {
|
void lime_al_auxf (value aux, int param, float value) {
|
||||||
|
|
||||||
@@ -3412,7 +3417,8 @@ namespace lime {
|
|||||||
value lime_alc_open_device (HxString devicename) {
|
value lime_alc_open_device (HxString devicename) {
|
||||||
|
|
||||||
ALCdevice* alcDevice = alcOpenDevice (devicename.__s);
|
ALCdevice* alcDevice = alcOpenDevice (devicename.__s);
|
||||||
atexit (lime_al_atexit);
|
//TODO: Can we work out our own cleanup for openal?
|
||||||
|
//atexit (lime_al_atexit);
|
||||||
|
|
||||||
value ptr = CFFIPointer (alcDevice, gc_alc_object);
|
value ptr = CFFIPointer (alcDevice, gc_alc_object);
|
||||||
alcObjects[alcDevice] = ptr;
|
alcObjects[alcDevice] = ptr;
|
||||||
@@ -3424,7 +3430,8 @@ namespace lime {
|
|||||||
HL_PRIM HL_CFFIPointer* HL_NAME(hl_alc_open_device) (hl_vstring* devicename) {
|
HL_PRIM HL_CFFIPointer* HL_NAME(hl_alc_open_device) (hl_vstring* devicename) {
|
||||||
|
|
||||||
ALCdevice* alcDevice = alcOpenDevice (devicename ? (char*)hl_to_utf8 ((const uchar*)devicename->bytes) : 0);
|
ALCdevice* alcDevice = alcOpenDevice (devicename ? (char*)hl_to_utf8 ((const uchar*)devicename->bytes) : 0);
|
||||||
atexit (lime_al_atexit);
|
//TODO: Can we work out our own cleanup for openal?
|
||||||
|
//atexit (lime_al_atexit);
|
||||||
|
|
||||||
HL_CFFIPointer* ptr = HLCFFIPointer (alcDevice, (hl_finalizer)hl_gc_alc_object);
|
HL_CFFIPointer* ptr = HLCFFIPointer (alcDevice, (hl_finalizer)hl_gc_alc_object);
|
||||||
alcObjects[alcDevice] = ptr;
|
alcObjects[alcDevice] = ptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user