From: James Turner Date: Mon, 28 Mar 2016 22:50:47 +0000 (+0100) Subject: Fix a reset crash with pager threading. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ca6424f76a25b46e9dd3a6ff7f80a400374dddec;p=flightgear.git Fix a reset crash with pager threading. Ensure pager thread is stopped before we touch the sgUserData reference to the main props tree. --- diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index e7c681f48..118dd1c12 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -68,6 +68,7 @@ #include #include #include +#include #include #include @@ -658,6 +659,9 @@ bool fgInitGeneral() { fgSetBool("/sim/startup/stdout-to-terminal", isatty(1) != 0 ); fgSetBool("/sim/startup/stderr-to-terminal", isatty(2) != 0 ); + + sgUserDataInit( globals->get_props() ); + return true; } @@ -1054,7 +1058,9 @@ void fgStartNewReset() render->getViewer()->getDatabasePager()->clear(); osgDB::Registry::instance()->clearObjectCache(); - + // Pager requests depend on this, so don't clear it until now + sgUserDataInit( NULL ); + // preserve the event handler; re-creating it would entail fixing the // idle handler osg::ref_ptr eventHandler = render->getEventHandler(); @@ -1095,6 +1101,8 @@ void fgStartNewReset() render->init(); render->setViewer(viewer.get()); + sgUserDataInit( globals->get_props() ); + viewer->getDatabasePager()->setUpThreads(1, 1); // must do this before splashinit for Rembrandt diff --git a/src/Scenery/scenery.cxx b/src/Scenery/scenery.cxx index 8ec3e5703..9b9df333f 100644 --- a/src/Scenery/scenery.cxx +++ b/src/Scenery/scenery.cxx @@ -332,17 +332,12 @@ void FGScenery::init() { particles_branch->setName("Particles"); scene_graph->addChild(particles_branch.get()); simgear::GlobalParticleCallback::setSwitch(fgGetNode("/sim/rendering/particles", true)); - - // Initials values needed by the draw-time object loader - sgUserDataInit( globals->get_props() ); _listener = new ScenerySwitchListener(this); } void FGScenery::shutdown() { - sgUserDataInit( NULL ); - scene_graph = NULL; terrain_branch = NULL; models_branch = NULL;