diff options
author | Chris Robinson <[email protected]> | 2011-10-24 08:23:41 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-10-24 08:23:41 -0700 |
commit | e5374f60c9fef1ccbeba86e7e9120519a5964c50 (patch) | |
tree | 71482da4f5b31ddfe296683edde25ed078ba185a /Alc | |
parent | 75679c959ab8619d1c12b2de6fdf991e7f70cc0d (diff) |
Don't close devices that are left open on lib shutdown
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 36 |
1 files changed, 12 insertions, 24 deletions
@@ -404,7 +404,7 @@ static pthread_once_t alc_config_once = PTHREAD_ONCE_INIT; /////////////////////////////////////////////////////// // ALC Related helper functions -static void ReleaseALC(ALCboolean doclose); +static void ReleaseALC(void); static void ReleaseThreadCtx(void *ptr); static void alc_initconfig(void); @@ -520,7 +520,7 @@ static void alc_init(void) static void alc_deinit_safe(void) { - ReleaseALC(ALC_FALSE); + ReleaseALC(); FreeHrtf(); FreeALConfig(); @@ -538,7 +538,7 @@ static void alc_deinit(void) { int i; - ReleaseALC(ALC_TRUE); + ReleaseALC(); memset(&PlaybackBackend, 0, sizeof(PlaybackBackend)); memset(&CaptureBackend, 0, sizeof(CaptureBackend)); @@ -2649,8 +2649,10 @@ ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffe } -static void ReleaseALC(ALCboolean doclose) +static void ReleaseALC(void) { + ALCdevice *dev; + free(alcDeviceList); alcDeviceList = NULL; alcDeviceListSize = 0; free(alcAllDeviceList); alcAllDeviceList = NULL; @@ -2665,27 +2667,13 @@ static void ReleaseALC(ALCboolean doclose) free(alcCaptureDefaultDeviceSpecifier); alcCaptureDefaultDeviceSpecifier = NULL; - if(doclose) - { - ALCdevice *dev; - while((dev=DeviceList) != NULL) - { - WARN("Closing device %p\n", dev); - if(!dev->IsCaptureDevice) alcCloseDevice(dev); - else alcCaptureCloseDevice(dev); - } - } - else + if((dev=ExchangePtr((void**)&DeviceList, NULL)) != NULL) { - ALCdevice *dev; - if((dev=DeviceList) != NULL) - { - ALCuint num = 0; - do { - num++; - } while((dev=dev->next) != NULL); - WARN("%u device%s not closed\n", num, (num>1)?"s":""); - } + ALCuint num = 0; + do { + num++; + } while((dev=dev->next) != NULL); + ERR("%u device%s not closed\n", num, (num>1)?"s":""); } } |