Merge pull request #10817 from garfieldkwong/fix_autorelease_branch

fix issue autorelease will not release trigger by autorelease.
This commit is contained in:
minggo 2015-03-16 14:47:30 +08:00
commit 2ea88a30bb
1 changed files with 3 additions and 2 deletions

View File

@ -65,11 +65,12 @@ void AutoreleasePool::clear()
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
_isClearing = true;
#endif
for (const auto &obj : _managedObjectArray)
std::vector<Ref*> releasings;
releasings.swap(_managedObjectArray);
for (const auto &obj : releasings)
{
obj->release();
}
_managedObjectArray.clear();
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
_isClearing = false;
#endif