mirror of https://github.com/encounter/SDL.git
Fixed crash when a controller is disconnected while rumble is pending
This commit is contained in:
parent
281d05a6d1
commit
428cfddb4c
|
@ -76,7 +76,9 @@ static int SDL_HIDAPI_RumbleThread(void *data)
|
||||||
|
|
||||||
if (request) {
|
if (request) {
|
||||||
SDL_LockMutex(request->device->dev_lock);
|
SDL_LockMutex(request->device->dev_lock);
|
||||||
|
if (request->device->dev) {
|
||||||
hid_write( request->device->dev, request->data, request->size );
|
hid_write( request->device->dev, request->data, request->size );
|
||||||
|
}
|
||||||
SDL_UnlockMutex(request->device->dev_lock);
|
SDL_UnlockMutex(request->device->dev_lock);
|
||||||
(void)SDL_AtomicDecRef(&request->device->rumble_pending);
|
(void)SDL_AtomicDecRef(&request->device->rumble_pending);
|
||||||
SDL_free(request);
|
SDL_free(request);
|
||||||
|
|
|
@ -477,7 +477,7 @@ static SDL_bool BTrySetupUSB(SDL_DriverSwitch_Context *ctx)
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_HighSpeed, NULL, 0, SDL_TRUE)) {
|
if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_HighSpeed, NULL, 0, SDL_TRUE)) {
|
||||||
/* The 8BitDo M30 doesn't respond to this command, but otherwise works correctly */
|
/* The 8BitDo M30 and SF30 Pro don't respond to this command, but otherwise work correctly */
|
||||||
/*return SDL_FALSE;*/
|
/*return SDL_FALSE;*/
|
||||||
}
|
}
|
||||||
if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_Handshake, NULL, 0, SDL_TRUE)) {
|
if (!WriteProprietary(ctx, k_eSwitchProprietaryCommandIDs_Handshake, NULL, 0, SDL_TRUE)) {
|
||||||
|
|
Loading…
Reference in New Issue