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
|
@ -237,20 +237,19 @@ bool FontAtlasCache::releaseFontAtlas(FontAtlas *atlas)
|
|||
{
|
||||
if (nullptr != atlas)
|
||||
{
|
||||
for( auto &item: _atlasMap )
|
||||
if (atlas->getReferenceCount() == 1)
|
||||
{
|
||||
if ( item.second == atlas )
|
||||
for( auto &item: _atlasMap )
|
||||
{
|
||||
if (atlas->getReferenceCount() == 1)
|
||||
if ( item.second == atlas )
|
||||
{
|
||||
_atlasMap.erase(item.first);
|
||||
_atlasMap.erase(item.first);
|
||||
break;
|
||||
}
|
||||
|
||||
atlas->release();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
atlas->release();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue