CCRepeatAction causing Win32 App to crash on closing

156 views Asked by At

Could someone help me figure out how to safely stop all actions when closing a Win32 cocos2dx app that is running CCRepeatAction. I have tried adding sprite->stopAllActions(); in the Destructor, OnExit() and in the update(float delta); methods but still app crashes when I click on the 'X' button of my running Win32 Cocos2dx app.

I am not retaining the CCRepeatAction and I have also tried just letting Cocos2D-X stop the running action when it does its cleanup, but it seems like if a CCAction is running while app is closed then app crashes. So my assumption is that the action has to be stopped when closing the Win32 App.

The repeat forever action is running on my idle state. It is a simple fadeIn/fadeOut CCAction. Here is the code for my Idle state animation. I am not retaining it so not sure how to stop the animation and close the app without crashing it.

if ( idleAnim == true ) 
{
    this->getSprite()->stopAllActions();
    CCSequence *actions = CCSequence::create(CCFadeIn::create(0.5f), CCFadeOut::create(0.5f),NULL);
    CCRepeatForever *repeat = CCRepeatForever::create(actions);
    this->getSprite()->runAction(repeat);
    idleAnim = false;
}
0

There are 0 answers