From 91374994cd2f2b0b27018b6f75c918d5c35035d8 Mon Sep 17 00:00:00 2001 From: dingpinglv Date: Thu, 11 Sep 2014 13:37:16 +0800 Subject: [PATCH] Fixed #5924: fixed a bug of cc.Component that its onExit isn't called. --- cocos2d/core/base-nodes/CCNode.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos2d/core/base-nodes/CCNode.js b/cocos2d/core/base-nodes/CCNode.js index 98ea360ecf..0e9d6e48c1 100644 --- a/cocos2d/core/base-nodes/CCNode.js +++ b/cocos2d/core/base-nodes/CCNode.js @@ -1557,6 +1557,7 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{ this._running = false; this.pause(); this._arrayMakeObjectsPerformSelector(this._children, cc.Node._StateCallbackType.onExit); + this.removeAllComponents(); }, // actions @@ -2042,7 +2043,7 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{ }, /** - * Removes all components + * Removes all components of cc.Node, it called when cc.Node is exiting from stage. * @function */ removeAllComponents: function () {