From: ehofman Date: Thu, 31 Dec 2009 10:14:56 +0000 (+0000) Subject: Also unbind subsystem groups in reverse order and destruct them in reverse order... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e8884b4ec0288cea058645e55230449fab723b04;p=simgear.git Also unbind subsystem groups in reverse order and destruct them in reverse order to be consistent. --- 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(); }