From afb95f2ceddd3201730d64a24f76a8938a348557 Mon Sep 17 00:00:00 2001 From: Vladimir Perminov Date: Wed, 26 Apr 2017 22:25:15 +0300 Subject: [PATCH] Memory leak, if set equal font in Label. setCharMap, setBMFontFilePath and setTTFConfigInternal use getFontAtlas. getFontAtlas retain font atlas always. setFontAtlas not release, if atlas equal current. For example call Label::setTTFConfig for equal ttfConfig. --- cocos/2d/CCLabel.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index a005dd730d..af6852c6ab 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -584,6 +584,10 @@ void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false * if (atlas == _fontAtlas) { + if (_fontAtlas) + { + FontAtlasCache::releaseFontAtlas(_fontAtlas); + } return; }