CCSet causing memory leaks.

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)
{
     CC_SAFE_RETAIN(pObject);
     m_pSet->insert(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.

<pre>
void CCSet::removeObject
{
m_pSet~~>erase(pObject);
CC_SAFE_RELEASE(pObject);
}

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.

<pre>
void CCSet::removeAllObjects
{
CCSetIterator it;
for ; it != m_pSet~~>end(); ++it)
{
if (! (*it))
{
break;
}

(*it)->release();
}
}

removeAllObjects() calls release on the object but does not remove it from the m\_pSet.