Android-only crash in CCTouchDispatcher::forceAddHandler

Hi there,

First up, thanks for this port. I’m porting an iphone cocos2d game over to cocos2d-x, with a main target of Android. So far I’ve been mostly using the win32 version for more rapid development, and it’s going pretty well. After adding touch support though, I’m now getting a crash in the android version only.

I haven’t quite got the hang of debugging the NDK, but I’ve used the arm-eabi-addr2line tool as well as debug prints, and have narrowed the crash down to CCTouchDispatcher::forceAddHandler.

Sometimes the top of the call stack is inside of the pArray->stl’s begin() function, and other time’s its when dereferencing the iter pointer. This happened to anyone else, or anyone got any idea what I might be doing wrong? Higher up the stack, i see it’s being called from CCLayer::onEnter(), via the registerWithTouchDispatcher() call.

Thanks in advance!
Isaac

Forgot to mention - i’m using NDK r5b, cocos2d-0.99.5-x-0.8.0, targetting android 2.2 and testing on the emulator.

OK, I had to update my NDK first. Downloading r5b now, the speed is toooo slow…
I’ll try to reproduce this bug tomorrow.

Thanks Walzer! But don’t worry about it too much, I’m in no rush - will probably be a week or so before I’m able to take another look into it.
I’ll also check out the tests and see if they’re all working correctly.

Isaac

I have built tests used by ndk-r5b, the code is got from github. The tests runs ok on g3. The tests invokes CCTouchDispatcher::forceAddHandler.
So I don’t think it is the matter with CCTouchDispatcher::forceAddHandler.

I have no problems with the latest from github, and I have no problems with touch handler on my evo 4G.

So, after starting a new project from scratch with your awesome new create-android-project script, and then just copying over my source, it’s now running on the emulator. Awesome!

Glad to hear that. Enjoy it!