1
0
Fork 0

Fix a couple of potential crashes on exit.

- Font cache shutdown explicitly
- Pending GUI snapshot cleared explicitly

Both of these are dependencies on the osgViewer / GLContext.
This commit is contained in:
James Turner 2016-12-10 23:24:09 +00:00
parent 4fb5bc8512
commit 85f75dee4f
5 changed files with 22 additions and 0 deletions

View file

@ -85,6 +85,11 @@ FGFontCache* FGFontCache::instance()
return global_fontCacheInstance.get();
}
void FGFontCache::shutdown()
{
global_fontCacheInstance.reset();
}
FGFontCache::FGFontCache() :
_initialized(false)
{

View file

@ -78,6 +78,7 @@ private:
public:
// note this accesor is NOT thread-safe
static FGFontCache* instance();
static void shutdown();
~FGFontCache();

View file

@ -47,6 +47,8 @@ extern void guiErrorMessage(const char *txt);
extern void guiErrorMessage(const char *txt, const sg_throwable &throwable);
extern bool fgDumpSnapShot();
void fgCancelSnapShot();
extern void fgDumpSceneGraph();
extern void fgDumpTerrainBranch();
extern void fgPrintVisibleSceneInfoCommand();

View file

@ -483,6 +483,11 @@ namespace
return true;
}
static void cancel()
{
_snapShotOp = nullptr;
}
private:
// constructor to be executed in main loop's thread
GUISnapShotOperation() :
@ -567,6 +572,11 @@ bool fgDumpSnapShot ()
return GUISnapShotOperation::start();
}
void fgCancelSnapShot()
{
GUISnapShotOperation::cancel();
}
// do an entire scenegraph dump
void fgDumpSceneGraph()
{

View file

@ -54,6 +54,7 @@
#include <Navaids/navlist.hxx>
#include <Viewer/renderer.hxx>
#include <Viewer/viewmgr.hxx>
#include <GUI/FGFontCache.hxx>
#include "globals.hxx"
#include "locale.hxx"
@ -223,6 +224,9 @@ FGGlobals::~FGGlobals()
// renderer touches subsystems during its destruction
set_renderer(NULL);
FGFontCache::shutdown();
fgCancelSnapShot();
delete subsystem_mgr;
subsystem_mgr = NULL; // important so ::get_subsystem returns NULL
vw = 0; // don't delete the viewer until now