Cocos2dx running Animation on Sprite crashes inside onTouchesEnded

Change the line in your header file to

RefPtr<Animate>  animateUp;

Thank you very much for the reply, it worked for the sprite which suffered from a similar issue, I think it will also work for my case too. Though im interested in how this worked? I mean all i knew from C++ were pointers. Now we have pointers, auto variables (which I think I know the mechanism) and now you mention RefPtr<T>. In the other hand we have traditional delete, CC_SAFE_DELETE and CC_SAFE_RELEASE for garbage collection. Any ideas where and how we should be using them for proper operation? For example now that I have a RefPtr<Sprite> a; am I going to delete it in my destructor using which from the above?