mirror of https://github.com/axmolengine/axmol.git
The releaseFontAtlas method will remove the font atlas from the cache if it has a reference count of 1, and will always call release on that atlas as expected by the calling code.
This commit is contained in:
parent
b60478ac90
commit
9b2b3de565
|
@ -236,22 +236,21 @@ FontAtlas* FontAtlasCache::getFontAtlasCharMap(const std::string& charMapFile, i
|
|||
bool FontAtlasCache::releaseFontAtlas(FontAtlas *atlas)
|
||||
{
|
||||
if (nullptr != atlas)
|
||||
{
|
||||
if (atlas->getReferenceCount() == 1)
|
||||
{
|
||||
for( auto &item: _atlasMap )
|
||||
{
|
||||
if ( item.second == atlas )
|
||||
{
|
||||
if (atlas->getReferenceCount() == 1)
|
||||
{
|
||||
_atlasMap.erase(item.first);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
atlas->release();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue