mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-11-21 20:47:19 +01:00
fix audio deadlock
James Zipperer Close the audio device before waiting for the audio thread to complete, which fixes a situation where the audio thread never completes Add an additional check in the audio thread to see if the device is enabled and bail out if the device is no longer enabled
This commit is contained in:
parent
56c88c4531
commit
2558c9c836
@ -1051,6 +1051,10 @@ close_audio_device(SDL_AudioDevice * device)
|
||||
{
|
||||
SDL_AtomicSet(&device->shutdown, 1);
|
||||
SDL_AtomicSet(&device->enabled, 0);
|
||||
|
||||
if (device->hidden != NULL) {
|
||||
current_audio.impl.CloseDevice(device);
|
||||
}
|
||||
if (device->thread != NULL) {
|
||||
SDL_WaitThread(device->thread, NULL);
|
||||
}
|
||||
@ -1061,9 +1065,6 @@ close_audio_device(SDL_AudioDevice * device)
|
||||
if (device->convert.needed) {
|
||||
SDL_free(device->convert.buf);
|
||||
}
|
||||
if (device->hidden != NULL) {
|
||||
current_audio.impl.CloseDevice(device);
|
||||
}
|
||||
|
||||
free_audio_queue(device->buffer_queue_head);
|
||||
free_audio_queue(device->buffer_queue_pool);
|
||||
|
Loading…
Reference in New Issue
Block a user