[Orxonox-commit 4959] r9628 - code/branches/core6/src/libraries/core/object

landauf at orxonox.net landauf at orxonox.net
Fri Aug 9 11:28:52 CEST 2013


Author: landauf
Date: 2013-08-09 11:28:52 +0200 (Fri, 09 Aug 2013)
New Revision: 9628

Modified:
   code/branches/core6/src/libraries/core/object/ObjectListBase.cc
Log:
object list should not delete its elements - they will be deleted by the corresponding Listable object (fixes crash if Context is deleted before the objects in its lists)

Modified: code/branches/core6/src/libraries/core/object/ObjectListBase.cc
===================================================================
--- code/branches/core6/src/libraries/core/object/ObjectListBase.cc	2013-08-08 22:27:05 UTC (rev 9627)
+++ code/branches/core6/src/libraries/core/object/ObjectListBase.cc	2013-08-09 09:28:52 UTC (rev 9628)
@@ -67,8 +67,17 @@
     */
     ObjectListBase::~ObjectListBase()
     {
-        while (this->first_)
-            delete this->first_;
+        ObjectListBaseElement* current = this->first_;
+        while (current)
+        {
+            ObjectListBaseElement* next = current->next_;
+
+            current->list_ = 0;
+            current->next_ = 0;
+            current->prev_ = 0;
+
+            current = next;
+        }
     }
 
     /**




More information about the Orxonox-commit mailing list