]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/globals.cxx
Make FGIO a proper subsystem and add a reinit method for the generic protocol. This...
[flightgear.git] / src / Main / globals.cxx
index b7305647638a4c730e7588cd4a4872e961517416..262423c2aec68a5fec223e1e11c9e3731882c55f 100644 (file)
@@ -95,7 +95,6 @@ FGGlobals::FGGlobals() :
     initial_waypoints( NULL ),
     scenery( NULL ),
     tile_mgr( NULL ),
-    io( new FGIO ),
     fontcache ( new FGFontCache ),
     navlist( NULL ),
     loclist( NULL ),
@@ -121,6 +120,13 @@ FGGlobals::~FGGlobals()
     // shut down all subsystems, make sure we take down the 
     // AIModels system first.
     subsystem_mgr->get_group(SGSubsystemMgr::GENERAL)->remove_subsystem("ai_model");
+    // FGInput (FGInputEvent) and FGDialog calls get_subsystem() in their destructors, 
+    // which is not safe since some subsystem are already deleted but can be referred.
+    // So these subsystems must be deleted prior to deleting subsystem_mgr unless
+    // ~SGSubsystemGroup and SGSubsystemMgr::get_subsystem are changed not to refer to
+    // deleted subsystems.
+    subsystem_mgr->get_group(SGSubsystemMgr::GENERAL)->remove_subsystem("input");
+    subsystem_mgr->get_group(SGSubsystemMgr::GENERAL)->remove_subsystem("gui");
     delete subsystem_mgr;
     delete event_mgr;
     delete time_params;
@@ -143,7 +149,6 @@ FGGlobals::~FGGlobals()
     delete initial_waypoints;
     delete tile_mgr;
     delete scenery;
-    delete io;
     delete fontcache;
 
     delete navlist;