Skip to content

Commit 5c39938

Browse files
Merge pull request #17756 from perminovVS/set-font-atlas-memory-leak
Memory leak in setFontAtlas, if set equal font in Label.
2 parents 2892826 + afb95f2 commit 5c39938

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)