1
0
Fork 0

Fix a reset crash with pager threading.

Ensure pager thread is stopped before we touch
the sgUserData reference to the main props tree.
This commit is contained in:
James Turner 2016-03-28 23:50:47 +01:00
parent 08ea386197
commit ca6424f76a
2 changed files with 9 additions and 6 deletions

View file

@ -68,6 +68,7 @@
#include <simgear/scene/material/Effect.hxx>
#include <simgear/scene/model/particles.hxx>
#include <simgear/scene/tsync/terrasync.hxx>
#include <simgear/scene/tgdb/userdata.hxx>
#include <simgear/package/Root.hxx>
#include <simgear/package/Package.hxx>
@ -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<flightgear::FGEventHandler> 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

View file

@ -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;