mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-05 09:26:25 +00:00
wasapi: Check for a NULL device during disconnect handling.
This is probably something we already cleaned up that has something running in an unexpected order now that we've moved disconnect work to the main thread.
This commit is contained in:
@@ -343,7 +343,7 @@ static void WASAPI_DetectDevices(SDL_AudioDevice **default_playback, SDL_AudioDe
|
|||||||
void WASAPI_DisconnectDevice(SDL_AudioDevice *device)
|
void WASAPI_DisconnectDevice(SDL_AudioDevice *device)
|
||||||
{
|
{
|
||||||
// don't block in here; IMMDevice's own thread needs to return or everything will deadlock.
|
// don't block in here; IMMDevice's own thread needs to return or everything will deadlock.
|
||||||
if (device->hidden && SDL_CompareAndSwapAtomicInt(&device->hidden->device_disconnecting, 0, 1)) {
|
if (device && device->hidden && SDL_CompareAndSwapAtomicInt(&device->hidden->device_disconnecting, 0, 1)) {
|
||||||
SDL_AudioDeviceDisconnected(device); // this proxies the work to the main thread now, so no point in proxying to the management thread.
|
SDL_AudioDeviceDisconnected(device); // this proxies the work to the main thread now, so no point in proxying to the management thread.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user