Hi, during the debugging of one of our apps, we found an issue with CCSet that has a chance of causing memory leaks depending on your use of it.
Basically, the problems lie in addObject, removeObject and removeAllObjects functions.
void CCSet::addObject(CCObject *pObject)
If you attempt to add an object that already exists in the CCSet, the retain count increments but the m_pSet~~>insert function does nothing as std::set only contains unique elements.
If you attempt to remove an object that doesn’t exist in the CCSet, m_pSet~~>erase does nothing, but the object’s retain count still gets decremented.
for ; it != m_pSet~~>end(); ++it)
if (! (*it))
removeAllObjects() calls release on the object but does not remove it from the m_pSet.