From ecad5ea3ce24d87b15d5794de6f39dadc9935ffb Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 28 Mar 2014 14:43:44 +0800 Subject: [PATCH] Fixed `ExtensionTest/CocoStudioComponentsTest` crash after applying PR #6011. --- cocos/2d/CCNode.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 848597b048..fc5f7c4aec 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -158,12 +158,6 @@ Node::~Node() // It may invoke `node->stopAllAction();` while `_actionManager` is null if the next line is after `CC_SAFE_RELEASE_NULL(_actionManager)`. CC_SAFE_RELEASE_NULL(_userObject); - CC_SAFE_RELEASE_NULL(_actionManager); - CC_SAFE_RELEASE_NULL(_scheduler); - - _eventDispatcher->removeEventListenersForTarget(this); - - // attributes CC_SAFE_RELEASE_NULL(_shaderProgram); @@ -180,7 +174,12 @@ Node::~Node() setPhysicsBody(nullptr); #endif - + + CC_SAFE_RELEASE_NULL(_actionManager); + CC_SAFE_RELEASE_NULL(_scheduler); + + _eventDispatcher->removeEventListenersForTarget(this); + #if CC_NODE_DEBUG_VERIFY_EVENT_LISTENERS && COCOS2D_DEBUG > 0 _eventDispatcher->debugCheckNodeHasNoEventListenersOnDestruction(this); #endif