Skip to content

Commit

Permalink
Merge pull request cocos2d#13987 from Dimon4eg/Fix-crash-in-FontFreeType
Browse files Browse the repository at this point in the history
Fix crash in destructor of FontFreeType
  • Loading branch information
pandamicro committed Sep 21, 2015
2 parents deacab9 + 09b5b7f commit b54a06a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cocos/2d/CCFontFreeType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,16 @@ bool FontFreeType::createFontObject(const std::string &fontName, int fontSize)

FontFreeType::~FontFreeType()
{
if (_stroker)
if (_FTInitialized)
{
FT_Stroker_Done(_stroker);
}
if (_fontRef)
{
FT_Done_Face(_fontRef);
if (_stroker)
{
FT_Stroker_Done(_stroker);
}
if (_fontRef)
{
FT_Done_Face(_fontRef);
}
}

s_cacheFontData[_fontName].referenceCount -= 1;
Expand Down

0 comments on commit b54a06a

Please sign in to comment.