Fixed occasional crash in CRobotMain::DeleteAllObjects

master
krzys-h 2015-03-29 15:50:47 +02:00
parent 1b18b145cc
commit 6844b2170f
1 changed files with 4 additions and 7 deletions

View File

@ -1929,15 +1929,12 @@ void CRobotMain::DeleteAllObjects()
for (int i = 0; i < MAXSHOWLIMIT; i++) for (int i = 0; i < MAXSHOWLIMIT; i++)
FlushShowLimit(i); FlushShowLimit(i);
for(auto it : CObjectManager::GetInstancePointer()->GetAllObjects()) while(CObjectManager::GetInstancePointer()->GetAllObjects().size() > 0)
{ {
CObject* obj = it.second; CObject* obj = CObjectManager::GetInstancePointer()->GetAllObjects().begin()->second;
if(obj != nullptr) obj->DeleteObject(true); // destroys rapidly
{ delete obj;
obj->DeleteObject(true); // destroys rapidly
delete obj;
}
} }
} }