From c0706a3141d73a16e98e873ed16c07cfc161d64d Mon Sep 17 00:00:00 2001 From: Darragh Coy Date: Fri, 6 Sep 2013 16:07:51 +0100 Subject: [PATCH 1/2] Fix a memory leak in Set::removeAllObjects. The set maintains a strong reference to all objects so release() should be called whenever something is removed from the set. --- cocos2dx/cocoa/CCSet.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cocos2dx/cocoa/CCSet.cpp b/cocos2dx/cocoa/CCSet.cpp index c957dedffb..a2cccff017 100644 --- a/cocos2dx/cocoa/CCSet.cpp +++ b/cocos2dx/cocoa/CCSet.cpp @@ -121,7 +121,9 @@ void Set::removeAllObjects() tmp = it; ++tmp; + Object * pObject = *it; _set->erase(it); + CC_SAFE_RELEASE(pObject); it = tmp; } } From 8654df7b0ed86d91223a349955f2d6d4cbf8805b Mon Sep 17 00:00:00 2001 From: Darragh Coy Date: Tue, 24 Sep 2013 21:01:30 +0100 Subject: [PATCH 2/2] Remove Hungarian notation. Remove Hungarian notation in fix made for memory leak in Set::removeAllObjects(). --- cocos2dx/cocoa/CCSet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos2dx/cocoa/CCSet.cpp b/cocos2dx/cocoa/CCSet.cpp index a2cccff017..c3c24e0e5e 100644 --- a/cocos2dx/cocoa/CCSet.cpp +++ b/cocos2dx/cocoa/CCSet.cpp @@ -121,9 +121,9 @@ void Set::removeAllObjects() tmp = it; ++tmp; - Object * pObject = *it; + Object * obj = *it; _set->erase(it); - CC_SAFE_RELEASE(pObject); + CC_SAFE_RELEASE(obj); it = tmp; } }