diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index e0ade22dd..73f0f79ba 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -54,6 +54,7 @@ #include #include +#include #include #include @@ -310,6 +311,10 @@ void fgExitCleanup() { // on the common exit path globals is already deleted, and NULL, // so this only happens on error paths. delete globals; + // avoid crash on exit (https://sourceforge.net/p/flightgear/codetickets/1935/) + simgear::GroundLightManager::instance()->getRunwayLightStateSet()->clear(); + simgear::GroundLightManager::instance()->getTaxiLightStateSet()->clear(); + simgear::GroundLightManager::instance()->getGroundLightStateSet()->clear(); simgear::shutdownLogging(); } diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 2e7997e81..4f3b37128 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -55,7 +55,6 @@ extern bool global_crashRptEnabled; #include #include #include -#include #include #include @@ -555,9 +554,6 @@ 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; }