cocos2d-x's input bug on android

I found a bug on android input handling.
I fixed it in Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd from:

void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd(JNIEnv*  env, jobject thiz, jint id, jfloat x, jfloat y)
{
    CCRect rcRect = CCEGLView::sharedOpenGLView().getViewPort();
    float fScreenScaleFactor = CCEGLView::sharedOpenGLView().getScreenScaleFactor();
    CCSet set;

    /* Add to the set to send to the director */
    CCTouch* pTouch = s_pTouches[id];       
    if (pTouch)
    {
        LOGD("Ending touches with id: %d, x=%f, y=%f", id, x, y);

        pTouch->SetTouchInfo(0, (x - rcRect.origin.x) / fScreenScaleFactor , (y - rcRect.origin.y) / fScreenScaleFactor);
        set.addObject(pTouch);          

        // release the object
        pTouch->release();
        s_pTouches[id] = NULL;

        cocos2d::CCDirector::sharedDirector()->getOpenGLView()->getDelegate()->touchesEnded(&set, NULL);            

    } else {
        LOGD("Ending touches with id: %d error", id);
    }       
}

to

void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd(JNIEnv*  env, jobject thiz, jint id, jfloat x, jfloat y)
{
    CCRect rcRect = CCEGLView::sharedOpenGLView().getViewPort();
    float fScreenScaleFactor = CCEGLView::sharedOpenGLView().getScreenScaleFactor();
    CCSet set;

    /* Add to the set to send to the director */
    CCTouch* pTouch = s_pTouches[id];       
    if (pTouch)
    {
        LOGD("Ending touches with id: %d, x=%f, y=%f", id, x, y);

        pTouch->SetTouchInfo(0, (x - rcRect.origin.x) / fScreenScaleFactor , (y - rcRect.origin.y) / fScreenScaleFactor);
        set.addObject(pTouch);          

        cocos2d::CCDirector::sharedDirector()->getOpenGLView()->getDelegate()->touchesEnded(&set, NULL);

        // release the object
        pTouch->release();
        s_pTouches[id] = NULL;
    } else {
        LOGD("Ending touches with id: %d error", id);
    }       
}

Best Regards.

When pTouch was added to set, the reference count is added, and pTouch->release() is only
minus the reference count.

So, I don’t think it is a bug.

When pTouch was added to set, the reference count is NOT added.
So, I think it is a bug.

Please, check again.

OK, I just checked this case. CCSet didn’t retain & release the children CCObjects.
Ming, should we add retain & release to CCSet?

I am sorry. CCSet didn’t retain the object.
#609 created for it.

Thank you “Big fan of Cocos2d-x”.