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 - Crash in Android SDL_mouse.c
Summary: Crash in Android SDL_mouse.c
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.1
Hardware: All Android (All)
: P2 critical
Assignee: Gabriel Jacobo
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-27 07:20 UTC by Sylvain
Modified: 2014-06-28 15:50 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!