From e8884b4ec0288cea058645e55230449fab723b04 Mon Sep 17 00:00:00 2001 From: ehofman Date: Thu, 31 Dec 2009 10:14:56 +0000 Subject: [PATCH] Also unbind subsystem groups in reverse order and destruct them in reverse order to be consistent. --- simgear/structure/subsystem_mgr.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/simgear/structure/subsystem_mgr.cxx b/simgear/structure/subsystem_mgr.cxx index 1c60f47b..ee9c15d1 100644 --- a/simgear/structure/subsystem_mgr.cxx +++ b/simgear/structure/subsystem_mgr.cxx @@ -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(); } -- 2.39.5