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 2220

Summary: SDL_PrivateJoystickButton on Android. Crash when pressing MENU button
Product: SDL Reporter: Sylvain <sylvain.becker>
Component: *don't know*Assignee: Gabriel Jacobo <gabomdq>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: gabomdq, philipp.wiesemann
Version: HG 2.1   
Hardware: x86_64   
OS: Android (All)   
Attachments: a basic patch

Description Sylvain 2013-11-07 21:34:12 UTC
Hello,

With my current version (hg.libsdl.org/SDL/rev/261addaa47d0).
I got a crash in "SDL_PrivateJoystickButton".

It happens on the emulator : API_19 / armeabi / gpu on
(appears also with different abi and api)
I did not try on real device as mine has no menu button.

Just by pressing the button "MENU" (Not the home ! "home" button is ok).

Here's the log,
thanks,

Sylvain


....
D/        (   50): HostConnection::get() New Host Connection established 0xb74decc8, tid 1001
W/IInputConnectionWrapper(  533): showStatusIcon on inactive InputConnection
D/dalvikvm(  361): GC_EXPLICIT freed 106K, 12% free 5600K/6344K, paused 19ms+8ms, total 167ms
F/libc    (  866): Fatal signal 11 (SIGSEGV) at 0x00000033 (code=1), thread 866 (net.jeu.game)
I/DEBUG   (   48): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   (   48): Build fingerprint: 'generic/sdk/generic:4.4/KRT16L/892118:eng/test-keys'
I/DEBUG   (   48): Revision: '0'
I/DEBUG   (   48): pid: 866, tid: 866, name: net.jeu.spider  >>> net.jeu.spider <<<
I/DEBUG   (   48): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000033
I/DEBUG   (   48):     r0 00000013  r1 0000003f  r2 00000001  r3 00000603
I/DEBUG   (   48):     r4 0000003f  r5 00000013  r6 00000001  r7 b6f3735c
I/DEBUG   (   48):     r8 be916040  r9 b1891898  sl b7710390  fp be916054
I/DEBUG   (   48):     ip aa2b8813  sp be915fe0  lr aa2bf899  pc aa2bf2ae  cpsr 60000030
I/DEBUG   (   48):     d0  0000000000000000  d1  0000000000000000
I/DEBUG   (   48):     d2  0000000000000000  d3  0000000000000000
I/DEBUG   (   48):     d4  0000000000000000  d5  4049000000000000
I/DEBUG   (   48):     d6  0000000000000000  d7  000000003fc00000
I/DEBUG   (   48):     d8  0000000000000000  d9  0000000000000000
I/DEBUG   (   48):     d10 0000000000000000  d11 0000000000000000
I/DEBUG   (   48):     d12 0000000000000000  d13 0000000000000000
I/DEBUG   (   48):     d14 0000000000000000  d15 0000000000000000
I/DEBUG   (   48):     scr 60000010
I/DEBUG   (   48): 
I/DEBUG   (   48): backtrace:
I/DEBUG   (   48):     #00  pc 0003b2ae  /data/app-lib/net.jeu.game-2/libSDL2.so (SDL_PrivateJoystickButton+37)
I/DEBUG   (   48):     #01  pc 0003b895  /data/app-lib/net.jeu.game-2/libSDL2.so (Android_OnPadDown+24)
I/DEBUG   (   48):     #02  pc 0001dbcc  /system/lib/libdvm.so (dvmPlatformInvoke+112)
I/DEBUG   (   48):     #03  pc 0004deff  /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+394)
I/DEBUG   (   48):     #04  pc 0003873d  /system/lib/libdvm.so (dvmCheckCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+8)
I/DEBUG   (   48):     #05  pc 0004f8ed  /system/lib/libdvm.so (dvmResolveNativeMethod(unsigned int const*, JValue*, Method const*, Thread*)+184)
Comment 1 Sylvain 2013-11-09 20:58:44 UTC
Created attachment 1414 [details]
a basic patch
Comment 2 Sylvain 2013-11-09 21:02:33 UTC
hello,

With the application on the emulator, when pressing Menu, I got padId == -1 and SYS_numjoysticks == 0 (I dont use the Joystick subsystem, neither do the Init of it).

I attached a basic patch, but I believe there should be a better solution.

thanks,

Sylvain
Comment 3 Philipp Wiesemann 2013-11-10 17:09:42 UTC
Maybe fixed with:
http://hg.libsdl.org/SDL/rev/8cff978e06e9
Comment 4 Gabriel Jacobo 2013-11-10 17:18:48 UTC
Sounds good, let's call it fixed.
Comment 5 Sylvain 2013-11-10 19:26:44 UTC
Thanks ! Yes, it's fixed.

but a java import is missing : 
import java.util.List

Sylvain
Comment 6 Gabriel Jacobo 2013-11-10 19:28:33 UTC
Do you have local changes? It works here as is.
Comment 7 Sylvain 2013-11-10 19:31:57 UTC
I have minor local change but not about the import.
Maybe this is the version of java ?

-compile:
    [javac] Compiling 4 source files to /home/slvn/build_android/proj_sdl_spider_armeabi/bin/classes
    [javac] /home/slvn/build_android/proj_sdl_spider_armeabi/src/org/libsdl/app/SDLActivity.java:848: cannot find symbol
    [javac] symbol  : class List
    [javac] location: class org.libsdl.app.SDLJoystickHandler_API12
    [javac]     private List<Integer> mJoyIdList;
    [javac]             ^
Comment 8 Gabriel Jacobo 2013-11-10 19:33:56 UTC
You have a merge problem. See here: http://hg.libsdl.org/SDL/file/8cff978e06e9/android-project/src/org/libsdl/app/SDLActivity.java#l847
Comment 9 Sylvain 2013-11-10 19:41:42 UTC
yes ! you are right ! I have missed this line !
thanks !

Sylvain