Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frequent crashes in Touch events by simply touching the screen (currently in iPhone Simulator) #308

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

SDLBugzilla commented Feb 10, 2021

This bug report was migrated from our old Bugzilla tracker.

Reported in version: HG 2.0
Reported for operating system, platform: iOS 3, iPhone/iPod touch

Comments on the original bug report:

On 2010-09-21 06:41:30 +0000, Pavel Kanzelsberger wrote:

Program received signal: “EXC_BAD_ACCESS”.
(gdb) bt

0 0x000e995b in SDL_GetFingerIndexId (touch=0x0, fingerid=97068992) at /Users/pavel/Sources/SDL/Xcode-iPhoneOS/SDL/../../src/events/SDL_touch.c:67

1 0x000e999a in SDL_GetFinger (touch=0x0, id=97068992) at /Users/pavel/Sources/SDL/Xcode-iPhoneOS/SDL/../../src/events/SDL_touch.c:77

2 0x000ea41b in SDL_SendTouchMotion (id=1, fingerid=97068992, relative=0, xin=181, yin=158, pressurein=1) at /Users/pavel/Sources/SDL/Xcode-iPhoneOS/SDL/../../src/events/SDL_touch.c:400

3 0x000c2f0c in -[SDL_uikitview touchesMoved:withEvent:] (self=0x5c5ed70, _cmd=0x221dc6c, touches=0x70830e0, event=0x5c16020) at /Users/pavel/Sources/SDL/Xcode-iPhoneOS/SDL/../../src/video/uikit/SDL_uikitview.m:190

4 0x008ca2a9 in -[UIWindow _sendTouchesForEvent:] ()

5 0x008ac1ec in -[UIApplication sendEvent:] ()

6 0x008b0ac4 in _UIApplicationHandleEvent ()

7 0x03e43afa in PurpleEventCallback ()

8 0x029f2dc4 in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION ()

9 0x02953737 in __CFRunLoopDoSource1 ()

10 0x029509c3 in __CFRunLoopRun ()

11 0x02950280 in CFRunLoopRunSpecific ()

12 0x029501a1 in CFRunLoopRunInMode ()

13 0x000c1f6b in UIKit_PumpEvents (_this=0x6041200) at /Users/pavel/Sources/SDL/Xcode-iPhoneOS/SDL/../../src/video/uikit/SDL_uikitevents.m:51

14 0x0006ffff in SDL_PumpEvents () at /Users/pavel/Sources/SDL/Xcode-iPhoneOS/SDL/../../src/events/SDL_events.c:434

15 0x0007006e in SDL_WaitEventTimeout (event=0xbfffdc60, timeout=-1) at /Users/pavel/Sources/SDL/Xcode-iPhoneOS/SDL/../../src/events/SDL_events.c:468

16 0x00070047 in SDL_WaitEvent (event=0xbfffdc60) at /Users/pavel/Sources/SDL/Xcode-iPhoneOS/SDL/../../src/events/SDL_events.c:456

17 0x00008267 in GUI_MAINLOOP (POLL=false, CALLBACKS=false) at gui.s:2771

18 0x000120a3 in GUI_LAYOUTDEFAULTCALLBACK_MOUSEBUTTON (LAYOUT=0xdd56420, OBJ=0x0, TAB=-1, X=171, Y=7, BUTTONS=1) at gui.s:25161

19 0x0001158b in GUI_LAYOUTMOUSEBUTTONDOWN (LAYOUT=0xdd56420, X=181, Y=157, BUTTONS=1) at gui.s:23671

20 0x0000839e in GUI_MAINLOOP (POLL=false, CALLBACKS=4294967295) at gui.s:2866

21 0x00008c47 in GUI_RUNAPP () at gui.s:3563

22 0x00006776 in APPSTART () at PascalLibrary.s:5227

23 0x0000251f in SDL_main (argc=1, argv=0x5c0f680) at /Users/pavel/Projects/iPhone/iPhoneEAGL/main.m:14

24 0x000c44cf in -[SDLUIKitDelegate postFinishLaunch] (self=0x5c18530, _cmd=0x196850) at /Users/pavel/Sources/SDL/Xcode-iPhoneOS/SDL/../../src/video/uikit/SDL_uikitappdelegate.m:75

25 0x0260dcea in __NSFireDelayedPerform ()

26 0x029f2d43 in CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION ()

27 0x029f4384 in __CFRunLoopDoTimer ()

28 0x02950d09 in __CFRunLoopRun ()

29 0x02950280 in CFRunLoopRunSpecific ()

30 0x029501a1 in CFRunLoopRunInMode ()

31 0x03e422c8 in GSEventRunModal ()

32 0x03e4238d in GSEventRun ()

33 0x008b4b58 in UIApplicationMain ()

34 0x000c43d8 in main (argc=1, argv=0xbffff004) at /Users/pavel/Sources/SDL/Xcode-iPhoneOS/SDL/../../src/video/uikit/SDL_uikitappdelegate.m:53

On 2010-12-15 01:55:22 +0000, Joseba García Echebarria wrote:

I believe the crash is caused by a check not being performed on wether an SDL_Touch element is NULL before using it in the SDL_SendTouchMotion function in src/events/SDL_touch.c around line 400.
Judging from the rest of the code, there's a missing

if (!touch) {
    return 0;
}

before using "touch" as SDL_GetFinger(), SDL_GetFingerIndexId() use touch->num_fingers without checking.

I can attach a patch if you like. It seems pretty straightforward, though.

I have yet to discover why touch is being returned as NULL as this error is only triggered when an actual gesture has been performed, maybe something related to SDL_AddTouch()?

If it serves of any help I'm compiling from standard Makefile's, not from XCode. The "Touch" and "Fireworks" demos in the repository seem to be working fine when compiled from Xcode.
I will try to compile those examples with my Makefile to see if missing compilation flags are to be blamed for this.

On 2010-12-17 03:41:14 +0000, Joseba García Echebarria wrote:

As additional info, this was happening in iOS 4.2 too, the additional check fixes the crash.

On 2011-01-28 10:22:44 +0000, Sam Lantinga wrote:

This is fixed in the repository, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant