From b420a33b68aa3c0ba3e49243be207fcac5bf3c9e Mon Sep 17 00:00:00 2001 From: rh101 Date: Tue, 17 Aug 2021 18:49:14 +1000 Subject: [PATCH] Revert check for reference count, since it was correct. [skip ci] --- cocos/2d/CCSpriteFrameCache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/CCSpriteFrameCache.cpp b/cocos/2d/CCSpriteFrameCache.cpp index c3cedb7317..0b05c714eb 100644 --- a/cocos/2d/CCSpriteFrameCache.cpp +++ b/cocos/2d/CCSpriteFrameCache.cpp @@ -151,7 +151,7 @@ void SpriteFrameCache::removeUnusedSpriteFrames() for (auto& iter : frames) { 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); spriteFrame->getTexture()->removeSpriteFrameCapInset(spriteFrame);