mirror of https://github.com/axmolengine/axmol.git
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:
parent
f0a834fcad
commit
2b581aba18
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue