1
0
Fork 0

clear GroundLightManager also on non-standard exits to avoid crash

(e.g. --show-aircraft,
https://sourceforge.net/p/flightgear/codetickets/1935/ )
This commit is contained in:
Rebecca N. Palmer 2017-01-28 23:07:23 +00:00
parent d343496084
commit 2b1336cd39
2 changed files with 5 additions and 4 deletions

View file

@ -54,6 +54,7 @@
#include <simgear/compiler.h>
#include <simgear/structure/exception.hxx>
#include <simgear/scene/tgdb/GroundLightManager.hxx>
#include <osg/Texture>
#include <osg/BufferObject>
@ -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();
}

View file

@ -55,7 +55,6 @@ 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>
@ -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;
}