[Orxonox-commit 3245] r7936 - code/branches/usability/src/orxonox/worldentities

landauf at orxonox.net landauf at orxonox.net
Sun Feb 20 17:45:04 CET 2011


Author: landauf
Date: 2011-02-20 17:45:04 +0100 (Sun, 20 Feb 2011)
New Revision: 7936

Modified:
   code/branches/usability/src/orxonox/worldentities/WorldEntity.cc
Log:
trying to fix a crash

Modified: code/branches/usability/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/branches/usability/src/orxonox/worldentities/WorldEntity.cc	2011-02-20 16:29:02 UTC (rev 7935)
+++ code/branches/usability/src/orxonox/worldentities/WorldEntity.cc	2011-02-20 16:45:04 UTC (rev 7936)
@@ -122,12 +122,14 @@
             std::set<WorldEntity*>::iterator it;
             while ((it = this->children_.begin()) != this->children_.end())
             {
+                WorldEntity* entity = *it;
+
                 // do this for all children, because even if getDeleteWithParent() returns true a child might still stay active due to smart pointers pointing to it
-                (*it)->setPosition((*it)->getWorldPosition());
-                this->detach(*it); // detach also erases the element from the children set
+                entity->setPosition(entity->getWorldPosition());
+                this->detach(entity); // detach also erases the element from the children set
 
-                if ((*it)->getDeleteWithParent())
-                    (*it)->destroy();
+                if (entity->getDeleteWithParent())
+                    entity->destroy();
             }
 
             if (this->physicalBody_)




More information about the Orxonox-commit mailing list