]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/globals.cxx
Break config init / aircraft loading apart.
[flightgear.git] / src / Main / globals.cxx
index 909c83fb662157b84911850e2d10e8442968824f..c666b54590259bf85fce1cb18a6848bc797b2aed 100644 (file)
@@ -146,7 +146,7 @@ FGGlobals::FGGlobals() :
     ATIS_mgr( NULL ),
     controls( NULL ),
     viewmgr( NULL ),
-    commands( SGCommandMgr::instance() ),
+    commands( new SGCommandMgr ),
     channel_options_list( NULL ),
     initial_waypoints( NULL ),
     fontcache ( new FGFontCache ),
@@ -215,7 +215,7 @@ FGGlobals::~FGGlobals()
     subsystem_mgr = NULL; // important so ::get_subsystem returns NULL 
 
     delete time_params;
-    delete matlib;
+    set_matlib(NULL);
     delete route_mgr;
     delete ATIS_mgr;
     delete channel_options_list;
@@ -230,6 +230,8 @@ FGGlobals::~FGGlobals()
     locale = NULL;
     
     props.clear();
+    
+    delete commands;
 }
 
 // set the fg_root path
@@ -520,10 +522,9 @@ FGGlobals::resetPropertyRoot()
 {
     delete locale;
     
-#if DEBUG_RESET
     SG_LOG(SG_GENERAL, SG_INFO, "root props refcount:" << props.getNumRefs());
     treeDumpRefCounts(0, props);
-#endif
+
     props = new SGPropertyNode;
     initProperties();
     locale = new FGLocale(props);
@@ -688,4 +689,11 @@ void FGGlobals::set_tile_mgr ( FGTileMgr *t )
     _tile_mgr = t;
 }
 
+void FGGlobals::set_matlib( SGMaterialLib *m )
+{
+    if (matlib)
+        delete matlib;
+    matlib = m;
+}
+
 // end of globals.cxx