Skip to content

Commit b9c7909

Browse files
committed
wasapi: Don't ignore device disconnect events on unopened devices.
Reference Issue #13317.
1 parent 2f41dd7 commit b9c7909

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/audio/wasapi/SDL_wasapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static void WASAPI_DetectDevices(SDL_AudioDevice **default_playback, SDL_AudioDe
347347
void WASAPI_DisconnectDevice(SDL_AudioDevice *device)
348348
{
349349
// don't block in here; IMMDevice's own thread needs to return or everything will deadlock.
350-
if (device && device->hidden && SDL_CompareAndSwapAtomicInt(&device->hidden->device_disconnecting, 0, 1)) {
350+
if (device && (!device->hidden || SDL_CompareAndSwapAtomicInt(&device->hidden->device_disconnecting, 0, 1))) {
351351
SDL_AudioDeviceDisconnected(device); // this proxies the work to the main thread now, so no point in proxying to the management thread.
352352
}
353353
}

0 commit comments

Comments
 (0)