From b7df9026c038f0c80501f4d563de7232196248e2 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 6 Oct 2013 19:08:33 +0200 Subject: [PATCH] Reset: Terrasync root can change, can be shutdown. --- simgear/scene/tsync/terrasync.cxx | 17 ++++++++++++++--- simgear/scene/tsync/terrasync.hxx | 5 ++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/simgear/scene/tsync/terrasync.cxx b/simgear/scene/tsync/terrasync.cxx index 48c0c64f..a95486f7 100644 --- a/simgear/scene/tsync/terrasync.cxx +++ b/simgear/scene/tsync/terrasync.cxx @@ -755,11 +755,10 @@ void SGTerraSync::SvnThread::writeCompletedTilesPersistentCache() const /////////////////////////////////////////////////////////////////////////////// // SGTerraSync //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -SGTerraSync::SGTerraSync(SGPropertyNode_ptr root) : +SGTerraSync::SGTerraSync() : _svnThread(NULL), last_lat(NOWHERE), last_lon(NOWHERE), - _terraRoot(root->getNode("/sim/terrasync",true)), _bound(false), _inited(false) { @@ -772,11 +771,16 @@ SGTerraSync::SGTerraSync(SGPropertyNode_ptr root) : SGTerraSync::~SGTerraSync() { - _tiedProperties.Untie(); delete _svnThread; _svnThread = NULL; sglog().removeCallback(_log); delete _log; + _tiedProperties.Untie(); +} + +void SGTerraSync::setRoot(SGPropertyNode_ptr root) +{ + _terraRoot = root->getNode("/sim/terrasync",true); } void SGTerraSync::init() @@ -786,11 +790,18 @@ void SGTerraSync::init() } _inited = true; + + assert(_terraRoot); _terraRoot->setBoolValue("built-in-svn-available",svn_built_in_available); reinit(); } +void SGTerraSync::shutdown() +{ + _svnThread->stop(); +} + void SGTerraSync::reinit() { // do not reinit when enabled and we're already up and running diff --git a/simgear/scene/tsync/terrasync.hxx b/simgear/scene/tsync/terrasync.hxx index 80efb1c6..63cb5452 100644 --- a/simgear/scene/tsync/terrasync.hxx +++ b/simgear/scene/tsync/terrasync.hxx @@ -40,10 +40,11 @@ class SGTerraSync : public SGSubsystem { public: - SGTerraSync(SGPropertyNode_ptr root); + SGTerraSync(); virtual ~SGTerraSync(); virtual void init(); + virtual void shutdown(); virtual void reinit(); virtual void bind(); virtual void unbind(); @@ -59,6 +60,8 @@ public: bool scheduleTile(const SGBucket& bucket); + void setRoot(SGPropertyNode_ptr root); + /// retrive the associated log object, for displaying log /// output somewhere (a UI, presumably) BufferedLogCallback* log() const -- 2.39.5