We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2356 - [Android] SDL_JoystickGetAttached does not function
Summary: [Android] SDL_JoystickGetAttached does not function
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: HG 2.1
Hardware: ARM Android (All)
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-21 03:25 UTC by David Brady
Modified: 2014-01-21 21:47 UTC (History)
1 user (show)

See Also:


Attachments
Patch (2.87 KB, text/plain)
2014-01-21 03:25 UTC, David Brady
Details
Patch 2 (2.94 KB, patch)
2014-01-21 03:38 UTC, David Brady
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Brady 2014-01-21 03:25:10 UTC
Created attachment 1527 [details]
Patch

The controller always reports itself as attached.  Patch to fix the problem is attached.  I copied over some relevant stuff from the Linux version of this feature.
Comment 1 David Brady 2014-01-21 03:38:51 UTC
Created attachment 1528 [details]
Patch 2

Fix memory leak...
Comment 2 Gabriel Jacobo 2014-01-21 14:29:43 UTC
How about just changing line 447 from

return !joystick->closed && (joystick->hwdata != NULL);

to

return !joystick->closed
Comment 3 David Brady 2014-01-21 19:13:01 UTC
Because closed is only set when SDL_JoystickClose is called, not when it's removed.
Comment 4 Gabriel Jacobo 2014-01-21 21:22:42 UTC
Should be fixed here: https://hg.libsdl.org/SDL/rev/df0bf33be2ca

Thanks for the report!
Comment 5 David Brady 2014-01-21 21:47:38 UTC
Ah, I didn't read that code carefully enough.  I thought that was a different joystick object in the list.  Thanks for the fix.