Skip to content

Commit afb95f2

Browse files
committed
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.
1 parent 1f1f1d8 commit afb95f2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cocos/2d/CCLabel.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,10 @@ void Label::setFontAtlas(FontAtlas* atlas,bool distanceFieldEnabled /* = false *
584584

585585
if (atlas == _fontAtlas)
586586
{
587+
if (_fontAtlas)
588+
{
589+
FontAtlasCache::releaseFontAtlas(_fontAtlas);
590+
}
587591
return;
588592
}
589593

0 commit comments

Comments
 (0)