]> git.mxchange.org Git - flightgear.git/commitdiff
Clear GroundLightManager on exit to avoid segfault
authorRebecca N. Palmer <rebecca_palmer@zoho.com>
Thu, 12 Feb 2015 16:39:28 +0000 (16:39 +0000)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Thu, 12 Feb 2015 16:39:28 +0000 (16:39 +0000)
While mostly harmless since you're exiting anyway, it's an annoying
distraction when the real problem is "unexpected exit" (e.g.
https://bugs.debian.org/763285 ), and blocks testing with LeakSanitizer

src/Main/main.cxx

index ebcb6bb7f21cb32cdf9f5e8eaab687385b0fe8b3..e77e70e15e1414e7878596af4ece8612a70fe616 100644 (file)
@@ -54,6 +54,7 @@ extern bool global_crashRptEnabled;
 #include <simgear/math/SGMath.hxx>
 #include <simgear/math/sg_random.h>
 #include <simgear/misc/strutils.hxx>
+#include <simgear/scene/tgdb/GroundLightManager.hxx>
 
 #include <Model/panelnode.hxx>
 #include <Scenery/scenery.hxx>
@@ -529,6 +530,9 @@ int fgMainInit( int argc, char **argv )
     // delete the NavCache here. This will cause the destruction of many cached
     // objects (eg, airports, navaids, runways).
     delete flightgear::NavDataCache::instance();
+    simgear::GroundLightManager::instance()->getRunwayLightStateSet()->clear();
+    simgear::GroundLightManager::instance()->getTaxiLightStateSet()->clear();
+    simgear::GroundLightManager::instance()->getGroundLightStateSet()->clear();
   
     return result;
 }