]> git.mxchange.org Git - simgear.git/commitdiff
Also unbind subsystem groups in reverse order and destruct them in reverse order...
authorehofman <ehofman>
Thu, 31 Dec 2009 10:14:56 +0000 (10:14 +0000)
committerTim Moore <timoore33@gmail.com>
Thu, 31 Dec 2009 18:42:53 +0000 (19:42 +0100)
simgear/structure/subsystem_mgr.cxx

index 1c60f47b068729e8d38d3c8f823dd5cacf3e3541..ee9c15d1750dab1ab90d5e02b1612f1a4712fa1d 100644 (file)
@@ -110,10 +110,11 @@ SGSubsystemGroup::SGSubsystemGroup ()
 
 SGSubsystemGroup::~SGSubsystemGroup ()
 {
-    for (unsigned int i = 0; i < _members.size(); i++)
+    // reverse order to prevent order dependency problems
+    for (unsigned int i = _members.size(); i > 0; i--)
     {
-        _members[i]->printTimingStatistics();
-        delete _members[i];
+        _members[i-1]->printTimingStatistics();
+        delete _members[i-1];
     }
 }
 
@@ -382,7 +383,8 @@ SGSubsystemMgr::bind ()
 void
 SGSubsystemMgr::unbind ()
 {
-    for (int i = 0; i < MAX_GROUPS; i++)
+    // reverse order to prevent order dependency problems
+    for (int i = MAX_GROUPS-1; i >= 0; i--)
         _groups[i].unbind();
 }