Revert check for reference count, since it was correct. [skip ci]

This commit is contained in:
rh101 2021-08-17 18:49:14 +10:00
parent 188345e42a
commit b420a33b68
1 changed files with 1 additions and 1 deletions

View File

@ -151,7 +151,7 @@ void SpriteFrameCache::removeUnusedSpriteFrames()
for (auto& iter : frames) for (auto& iter : frames)
{ {
auto* spriteFrame = iter.second; auto* spriteFrame = iter.second;
if (spriteFrame->getReferenceCount() <= 2) // A frame has a ref count of 1 when created, and 2 when added to cocos2d::Map. It is unused if the ref count is 2. if (spriteFrame->getReferenceCount() == 1)
{ {
toRemoveFrames.push_back(iter.first); toRemoveFrames.push_back(iter.first);
spriteFrame->getTexture()->removeSpriteFrameCapInset(spriteFrame); spriteFrame->getTexture()->removeSpriteFrameCapInset(spriteFrame);