From 4a3b8c57654f633d8e6923f7217ea4b4d36938a1 Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 12 Nov 2013 23:36:18 +0000 Subject: [PATCH] Reset: changes for SGSubsystem ownership. Keep in sync with updated ownership model in subsystem groups. --- src/Environment/environment_mgr.cxx | 19 ------------------- src/Main/globals.cxx | 13 ++++++++----- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/src/Environment/environment_mgr.cxx b/src/Environment/environment_mgr.cxx index 9aca5b0b5..9a46f15d1 100644 --- a/src/Environment/environment_mgr.cxx +++ b/src/Environment/environment_mgr.cxx @@ -100,31 +100,12 @@ FGEnvironmentMgr::FGEnvironmentMgr () : FGEnvironmentMgr::~FGEnvironmentMgr () { - SGSubsystem * subsys; - - subsys = get_subsystem( "ridgelift" ); remove_subsystem( "ridgelift" ); - delete subsys; - - subsys = get_subsystem( "terrainsampler" ); remove_subsystem( "terrainsampler" ); - delete subsys; - - subsys = get_subsystem( "precipitation" ); remove_subsystem("precipitation"); - delete subsys; - - subsys = get_subsystem("realwx"); remove_subsystem("realwx"); - delete subsys; - - subsys = get_subsystem("controller"); remove_subsystem("controller"); - delete subsys; - - subsys = get_subsystem("magvar"); remove_subsystem("magvar"); - delete subsys; delete fgClouds; delete _environment; diff --git a/src/Main/globals.cxx b/src/Main/globals.cxx index a6381569b..767dcb5a2 100644 --- a/src/Main/globals.cxx +++ b/src/Main/globals.cxx @@ -185,13 +185,17 @@ FGGlobals::~FGGlobals() // deallocation of AIModel objects. To ensure we can safely // shut down all subsystems, make sure we take down the // AIModels system first. - SGSubsystem* ai = subsystem_mgr->remove("ai-model"); + SGSubsystem* ai = globals->get_subsystem("ai-model"); if (ai) { ai->unbind(); - delete ai; + subsystem_mgr->remove("ai-model"); } - SGSubsystem* sound = subsystem_mgr->remove("sound"); - + + subsystem_mgr->remove("fx"); + subsystem_mgr->remove("sound"); + subsystem_mgr->remove("tile-manager"); + subsystem_mgr->remove("model-manager"); + subsystem_mgr->shutdown(); subsystem_mgr->unbind(); delete subsystem_mgr; @@ -211,7 +215,6 @@ FGGlobals::~FGGlobals() delete fontcache; delete channellist; - delete sound; delete locale; locale = NULL; -- 2.39.5