Hello, everybody.
When I start up my first demo in android(Windows) by following Tutorials.
The program Crashes in the function CCMenu::itemForTouch.(My NDK is 7rd, and used cocos2d-1.0.1-x-0.11.0, run in android 2.2 emulator).
When I make a little change to CCMenu::itemForTouch, the crash problem disappeared.
Is it a bug of cocos OR g++ ?
Hope for reply. Thanks.
Code is pasted below.
CCMenuItem* CCMenu::itemForTouch(CCTouch *touch)
{
CCPoint touchLocation = touch~~>locationInView);
touchLocation = CCDirector::sharedDirector~~>convertToGL;
if > 0)
{
CCObject* pObject = NULL;
CCARRAY_FOREACH
{
//CCNode* pChild = dynamic_cast<CCNode*>;
↑↑↑↑ ★★★ if I change dynamic_cast to the code below. The crash clear. It seems dynamic_cast got a wrong address.
CCNode* pChild = ;
if && pChild)>getIsEnabled)<— ★★★ it crashes here.>convertToNodeSpace(touchLocation);
{
CCPoint local = pChild
CCRect r = ((CCMenuItem*)pChild)>rect;
r.origin = CCPointZero;
if )
{
return pChild;
}
}
}
}
return NULL;
}
——————