From 656842d6f10c05f1d5fe7773766404566fdd63a9 Mon Sep 17 00:00:00 2001 From: GarfieldKwong Date: Wed, 11 Mar 2015 15:31:06 +0800 Subject: [PATCH] fix issue autorelease will not release trigger by autorelease. --- cocos/base/CCAutoreleasePool.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cocos/base/CCAutoreleasePool.cpp b/cocos/base/CCAutoreleasePool.cpp index edf40f668e..e3a600244b 100644 --- a/cocos/base/CCAutoreleasePool.cpp +++ b/cocos/base/CCAutoreleasePool.cpp @@ -65,11 +65,12 @@ void AutoreleasePool::clear() #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) _isClearing = true; #endif - for (const auto &obj : _managedObjectArray) + std::vector releasings; + releasings.swap(_managedObjectArray); + for (const auto &obj : releasings) { obj->release(); } - _managedObjectArray.clear(); #if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) _isClearing = false; #endif