From 31abe4a7b28da5f364e25d8c5000e2d23dda5258 Mon Sep 17 00:00:00 2001 From: zilongshanren Date: Wed, 28 Jun 2017 18:24:12 +0800 Subject: [PATCH] fix Editor sgLabel pool issue --- cocos2d/core/components/CCLabel.js | 1 + cocos2d/core/label/CCSGLabel.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cocos2d/core/components/CCLabel.js b/cocos2d/core/components/CCLabel.js index 0609d34ed7..9daddd564d 100644 --- a/cocos2d/core/components/CCLabel.js +++ b/cocos2d/core/components/CCLabel.js @@ -598,6 +598,7 @@ var Label = cc.Class({ var sgNodeBeforeDestroy = this._sgNode; this._super(); if (sgNodeBeforeDestroy) { + sgNodeBeforeDestroy.removeFromParent(true); _ccsg.Label.pool.put(sgNodeBeforeDestroy); } } diff --git a/cocos2d/core/label/CCSGLabel.js b/cocos2d/core/label/CCSGLabel.js index d7a6547967..3bc20effef 100644 --- a/cocos2d/core/label/CCSGLabel.js +++ b/cocos2d/core/label/CCSGLabel.js @@ -1247,7 +1247,7 @@ _ccsg.Label = _ccsg.Node.extend({ }); _ccsg.Label.pool = new JS.Pool(function (label) { - if (!(label instanceof _ccsg.Label)) { + if (CC_EDITOR || !(label instanceof _ccsg.Label)) { return false; } label._string = "";