Fix crash: use cocostudio gui editor, create a action in editor, when you play like:

auto _action = getActionByName("action_name");
        _action->play(CallFunc::create([](){
		CCLOG("done.");
        }));
It'll crash.
This commit is contained in:
Jason Xu 2014-05-08 10:52:31 +08:00
parent f0a834fcad
commit 2b581aba18
1 changed files with 7 additions and 0 deletions

View File

@ -52,6 +52,7 @@ ActionObject::~ActionObject()
{
_actionNodeList.clear();
CC_SAFE_RELEASE(_pScheduler);
CC_SAFE_RELEASE(_CallBack);
}
void ActionObject::setName(const char* name)
@ -166,6 +167,7 @@ void ActionObject::play(CallFunc* func)
{
this->play();
this->_CallBack = func;
CC_SAFE_RETAIN(_CallBack);
}
void ActionObject::pause()
{
@ -214,6 +216,11 @@ void ActionObject::simulationActionUpdate(float dt)
{
this->play();
}
else
{
CC_SAFE_RELEASE_NULL(_CallBack);
_pScheduler->unschedule(schedule_selector(ActionObject::simulationActionUpdate), this);
}
}
}
}