Attempt to fix ref-ptr crash on exit
Fixing Sentry issue FLIGHTGEAR-9
This commit is contained in:
parent
06b026a218
commit
bade1ec4c6
1 changed files with 15 additions and 10 deletions
|
@ -207,14 +207,19 @@ FGGlobals::~FGGlobals()
|
||||||
|
|
||||||
// stop OSG threading first, to avoid thread races while we tear down
|
// stop OSG threading first, to avoid thread races while we tear down
|
||||||
// scene-graph pieces
|
// scene-graph pieces
|
||||||
osg::ref_ptr<osgViewer::Viewer> vw(renderer->getViewer());
|
// there are some scenarios where renderer is already gone.
|
||||||
if (vw) {
|
osg::ref_ptr<osgViewer::Viewer> vw;
|
||||||
// https://code.google.com/p/flightgear-bugs/issues/detail?id=1291
|
if (renderer) {
|
||||||
// explicitly stop trheading before we delete the renderer or
|
vw = renderer->getViewer();
|
||||||
// viewMgr (which ultimately holds refs to the CameraGroup, and
|
if (vw) {
|
||||||
// GraphicsContext)
|
// https://code.google.com/p/flightgear-bugs/issues/detail?id=1291
|
||||||
vw->stopThreading();
|
// explicitly stop trheading before we delete the renderer or
|
||||||
|
// viewMgr (which ultimately holds refs to the CameraGroup, and
|
||||||
|
// GraphicsContext)
|
||||||
|
vw->stopThreading();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subsystem_mgr->shutdown();
|
subsystem_mgr->shutdown();
|
||||||
subsystem_mgr->unbind();
|
subsystem_mgr->unbind();
|
||||||
|
|
||||||
|
@ -229,14 +234,14 @@ FGGlobals::~FGGlobals()
|
||||||
subsystem_mgr->remove(FGScenery::staticSubsystemClassId());
|
subsystem_mgr->remove(FGScenery::staticSubsystemClassId());
|
||||||
|
|
||||||
// renderer touches subsystems during its destruction
|
// renderer touches subsystems during its destruction
|
||||||
set_renderer(NULL);
|
set_renderer(nullptr);
|
||||||
|
|
||||||
FGFontCache::shutdown();
|
FGFontCache::shutdown();
|
||||||
fgCancelSnapShot();
|
fgCancelSnapShot();
|
||||||
|
|
||||||
delete subsystem_mgr;
|
delete subsystem_mgr;
|
||||||
subsystem_mgr = NULL; // important so ::get_subsystem returns NULL
|
subsystem_mgr = nullptr; // important so ::get_subsystem returns NULL
|
||||||
vw = nullptr; // don't delete the viewer until now
|
vw = nullptr;
|
||||||
set_matlib(NULL);
|
set_matlib(NULL);
|
||||||
|
|
||||||
delete time_params;
|
delete time_params;
|
||||||
|
|
Loading…
Add table
Reference in a new issue