1. fixes ActionManagerEx crashes.

This commit is contained in:
zhangcheng 2014-07-17 17:24:41 +08:00
parent 30f4a5cced
commit 24d87ad05b
2 changed files with 14 additions and 1 deletions

View File

@ -42,9 +42,14 @@ ActionManagerEx* ActionManagerEx::getInstance()
void ActionManagerEx::destroyInstance()
{
if(sharedActionManager != nullptr)
{
sharedActionManager->releaseActions();
CC_SAFE_DELETE(sharedActionManager);
}
}
ActionManagerEx::ActionManagerEx()
{
}
@ -154,6 +159,13 @@ void ActionManagerEx::releaseActions()
for (iter = _actionDic.begin(); iter != _actionDic.end(); iter++)
{
cocos2d::Vector<ActionObject*> objList = iter->second;
int listCount = objList.size();
for (int i = 0; i < listCount; i++) {
ActionObject* action = objList.at(i);
if (action != nullptr) {
action->stop();
}
}
objList.clear();
}

View File

@ -277,6 +277,7 @@ cocos2d::Node* LoadSceneEdtiorFileTest::createGameScene()
{
_filePath = "scenetest/LoadSceneEdtiorFileTest/FishJoy2.json"; //default is json
_rootNode = SceneReader::getInstance()->createNodeWithSceneFile(_filePath.c_str());
ActionManagerEx::getInstance()->playActionByName("startMenu_1.json", "Animation1");
if (_rootNode == nullptr)
{
return nullptr;