mirror of https://github.com/axmolengine/axmol.git
Merge pull request #3064 from minggo/iss2361-set-bugfix
fix a crash caused by Set::removeAllObjects()
This commit is contained in:
commit
735ebf0e7f
|
@ -109,15 +109,20 @@ void Set::removeObject(Object *pObject)
|
|||
|
||||
void Set::removeAllObjects()
|
||||
{
|
||||
for (SetIterator it = _set->begin(); it != _set->end(); )
|
||||
SetIterator it = _set->begin();
|
||||
SetIterator tmp;
|
||||
|
||||
while (it != _set->end())
|
||||
{
|
||||
if (!(*it))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
(*it)->release();
|
||||
_set->erase(it++);
|
||||
tmp = it;
|
||||
++tmp;
|
||||
_set->erase(it);
|
||||
it = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue