After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 780920 - Plugging more than 2 gamepads orderly will always lead to a segmentation fault.
Plugging more than 2 gamepads orderly will always lead to a segmentation fault.
Status: RESOLVED FIXED
Product: gnome-games
Classification: Core
Component: general
3.24.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Games maintainers
GNOME Games maintainers
Depends on:
Blocks:
 
 
Reported: 2017-04-05 09:09 UTC by Abhinav Singh
Modified: 2017-04-07 11:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
retro: Fix seg-fault when plugging many gamepads (957 bytes, patch)
2017-04-05 09:17 UTC, Abhinav Singh
none Details | Review
retro: Refactor input manager (4.72 KB, patch)
2017-04-06 06:15 UTC, Abhinav Singh
none Details | Review
retro: Refactor input manager (4.87 KB, patch)
2017-04-06 10:26 UTC, Abhinav Singh
committed Details | Review

Description Abhinav Singh 2017-04-05 09:09:33 UTC
Mostly unrecognisable because usually people don't use 2+ gamepads. The bug is in how RetroInputManager handles the ports and gamepads.
Comment 1 Abhinav Singh 2017-04-05 09:17:45 UTC
Created attachment 349279 [details] [review]
retro: Fix seg-fault when plugging many gamepads

Fix handling of gamepads array for which keyboard port was going out of
bounds.
Comment 2 Abhinav Singh 2017-04-05 09:20:05 UTC
Adrien: I think RetroInputManager needs a bit of reformat, so many repetitive code blocks! :P Should I patch it up?
Comment 3 Adrien Plazas 2017-04-05 10:29:17 UTC
Like having only one function handling both 'is_port_plugged' and 'gamepads'? Sounds good to me. :) You can directly do it instead of the previous patch.
Comment 4 Abhinav Singh 2017-04-06 06:15:51 UTC
Created attachment 349338 [details] [review]
retro: Refactor input manager

Remove use of is_port_plugged array and introduce input_devices array to
handle both gamepads and keyboard together.
Comment 5 Abhinav Singh 2017-04-06 10:26:19 UTC
Created attachment 349349 [details] [review]
retro: Refactor input manager

Replace the use of is_port_plugged array and gamepads array with
input_devices array.

Saving the plugged state of each gamepad is redundant and by using the
base class Retro.InputDevice we can handle gamepads and keyboard
together to avoid redundancy and errors.
Comment 6 Adrien Plazas 2017-04-07 11:54:55 UTC
Review of attachment 349349 [details] [review]:

It looks ok. And if we need something more complex later (for the gamepad assignment widget) we can modify it later anyway.
Comment 7 Adrien Plazas 2017-04-07 11:55:42 UTC
Attachment 349349 [details] pushed as bd652b7 - retro: Refactor input manager