[colobot] 304/390: Fixed occasional crash in CRobotMain::DeleteAllObjects

Didier Raboud odyx at moszumanska.debian.org
Fri Jun 12 14:21:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch upstream/latest
in repository colobot.

commit 6844b2170fe7c948cd5545ff79be539c13eb4084
Author: krzys-h <krzys_h at interia.pl>
Date:   Sun Mar 29 15:50:47 2015 +0200

    Fixed occasional crash in CRobotMain::DeleteAllObjects
---
 src/object/robotmain.cpp | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index 2efd262..088abd3 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -1929,15 +1929,12 @@ void CRobotMain::DeleteAllObjects()
     for (int i = 0; i < MAXSHOWLIMIT; 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;
     }
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list