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 2610

Summary: Crash in Android SDL_mouse.c
Product: SDL Reporter: Sylvain <sylvain.becker>
Component: *don't know*Assignee: Gabriel Jacobo <gabomdq>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: critical    
Priority: P2 CC: gabomdq
Version: HG 2.1   
Hardware: All   
OS: Android (All)   

Description Sylvain 2014-06-27 07:20:18 UTC
Hello,

I marked this bug as critical, because Android is currently crashing when pressing the Touch Screen.
It happens since this commit (https://hg.libsdl.org/SDL/diff/dc80dc0bd22e/src/events/SDL_mouse.c).

Because, on Android the mouse function is called with a NULL window pointer.
   
     SDL_androidtouch.c, line 89:  SDL_SendMouseMotion(NULL, SDL_TOUCH_MOUSEID, 0, window_x, window_y);

and this pointer is now used in SDL.c. This can be solved with:

-    if ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0) {
+    if (window != NULL && (window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0) {


And Also, maybe Android should send a correct SDL_window (ie Android_Window) ?

Cheers,
Sylvain
Comment 1 Sylvain 2014-06-27 08:46:07 UTC
(in case you choose to update Android, there could be the same problem in IOS with src/video/uikit/SDL_uikitview.m: SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID )
Comment 2 Gabriel Jacobo 2014-06-28 15:50:54 UTC
Fixed, thanks!