Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Rumble Crash joystick->hwdata == null if rumble attempted and GamePad disconnects #10422

Closed
AntTheAlchemist opened this issue Jul 29, 2024 · 3 comments · Fixed by #10423

Comments

@AntTheAlchemist
Copy link
Contributor

AntTheAlchemist commented Jul 29, 2024

SDL_sysjoystick.c, ANDROID_JoystickRumble(), line #592 crashed due to "item" being null. This happened on an 8BitDo Pro 2, connected via Bluetooth. Rumble (& triggers) were attempted, but failed, as not supported (as per usual with Bluetooth & Android). Something in SDL's background keep's retrying the rumble ? and sets an error "That operation is not supported". If I slide the switch of this GamePad to a different mode, to force it to disconnect, this crash happens after a SDL_PumpEvents(), which triggers an SDL_UpdateJoysticks(), which calls ANDROID_JoystickRumble() on an invalid joystick, which has a nulled "hwdata".

Convoluted bug report, sorry, but is it enough to show what's happening? I'll keep trying to see if it's easy to trigger other ways.

slouken added a commit to slouken/SDL that referenced this issue Jul 29, 2024
This prevents continuing a rumble after the first one fails, and fixes a long standing crash issue if rumble is started immediately before the controller is disconnected.

Thanks to @AntTheAlchemist for the key bug report that showed what was happening here.

Fixes libsdl-org#10422
@slouken
Copy link
Collaborator

slouken commented Jul 29, 2024

That makes total sense. Can you try the patch in the PR and see if that fixes it for you?

@AntTheAlchemist
Copy link
Contributor Author

Yep! That appears to have fixed it.

@slouken
Copy link
Collaborator

slouken commented Jul 29, 2024

Thanks!

slouken added a commit that referenced this issue Jul 29, 2024
This prevents continuing a rumble after the first one fails, and fixes a long standing crash issue if rumble is started immediately before the controller is disconnected.

Thanks to @AntTheAlchemist for the key bug report that showed what was happening here.

Fixes #10422

(cherry picked from commit 0a924b1)
slouken added a commit that referenced this issue Jul 29, 2024
This prevents continuing a rumble after the first one fails, and fixes a long standing crash issue if rumble is started immediately before the controller is disconnected.

Thanks to @AntTheAlchemist for the key bug report that showed what was happening here.

Fixes #10422

(cherry picked from commit 0a924b1)
(cherry picked from commit 7fdf794)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants