closed #2361:fix a crsash caused by Set::removeAllObjects

This commit is contained in:
minggo 2013-07-03 15:26:58 +08:00
parent 1bd5398f91
commit f089e62e8f
1 changed files with 8 additions and 3 deletions

View File

@ -109,15 +109,20 @@ void Set::removeObject(Object *pObject)
void Set::removeAllObjects() void Set::removeAllObjects()
{ {
for (SetIterator it = _set->begin(); it != _set->end(); ) SetIterator it = _set->begin();
SetIterator tmp;
while (it != _set->end())
{ {
if (!(*it)) if (!(*it))
{ {
break; break;
} }
(*it)->release(); tmp = it;
_set->erase(it++); ++tmp;
_set->erase(it);
it = tmp;
} }
} }