[SDL 2.0.5] Bug in SDL_CloseAudioDevice() on disabled devices

Consider this scenario:
You have multiple audio output devices in your OS, and your run an SDL2 program that opens one of them with SDL_OpenAudioDevice().
If you disable the used device (f.ex. removing a USB headset or manually disable it) in your OS while the program is running, then call SDL_CloseAudioDevice() when the program is shut down, it will stall forever in said function. This is a pretty serious bug, because there’s nothing the user and developer can do to overcome it, since closing the audio device is a crucial step in an exit cleanup.
It seems that SDL_Quit() will also freeze, so I assume that something with the audio device cleanup is happening there as well.

This is tested and confirmed to freeze on Windows 10 and macOS 10.12.4 (latest). I have no idea if it freezes on other OSes and versions, but it’s likely.

I believe we fixed this after 2.0.5 shipped. If you get a chance, try the latest in Mercurial and see if it works better for you.

Yes, it indeed seems to have been fixed after 2.0.5 was released. I just wanted to mention the bug in case it was not found yet.
Compiling the library myself is not my cup of tea, because I don’t know what compiler settings the original DLL used, and there’s always something… like a degrade in performance, for instance, because the Visual Studio project file in the source code seems to be different than the one used for official compilation. I don’t even know how to optimally compile it for macOS either.
Oh well, I just have to wait a few years until 2.0.6 is released. :wink:

1 Like

Oh well, I just have to wait a few years until 2.0.6 is released. :wink:

We’re working on finalizing a 2.0.6 release right now. :slight_smile:

Well, still no SDL2.0.6… :neutral_face: