Reset: Terrasync root can change, can be shutdown.

This commit is contained in:
James Turner
2013-11-12 23:04:13 +00:00
parent 6527c6357b
commit b7df9026c0
2 changed files with 18 additions and 4 deletions
+14 -3
View File
@@ -755,11 +755,10 @@ void SGTerraSync::SvnThread::writeCompletedTilesPersistentCache() const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// SGTerraSync //////////////////////////////////////////////////////////////// // SGTerraSync ////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SGTerraSync::SGTerraSync(SGPropertyNode_ptr root) : SGTerraSync::SGTerraSync() :
_svnThread(NULL), _svnThread(NULL),
last_lat(NOWHERE), last_lat(NOWHERE),
last_lon(NOWHERE), last_lon(NOWHERE),
_terraRoot(root->getNode("/sim/terrasync",true)),
_bound(false), _bound(false),
_inited(false) _inited(false)
{ {
@@ -772,11 +771,16 @@ SGTerraSync::SGTerraSync(SGPropertyNode_ptr root) :
SGTerraSync::~SGTerraSync() SGTerraSync::~SGTerraSync()
{ {
_tiedProperties.Untie();
delete _svnThread; delete _svnThread;
_svnThread = NULL; _svnThread = NULL;
sglog().removeCallback(_log); sglog().removeCallback(_log);
delete _log; delete _log;
_tiedProperties.Untie();
}
void SGTerraSync::setRoot(SGPropertyNode_ptr root)
{
_terraRoot = root->getNode("/sim/terrasync",true);
} }
void SGTerraSync::init() void SGTerraSync::init()
@@ -786,11 +790,18 @@ void SGTerraSync::init()
} }
_inited = true; _inited = true;
assert(_terraRoot);
_terraRoot->setBoolValue("built-in-svn-available",svn_built_in_available); _terraRoot->setBoolValue("built-in-svn-available",svn_built_in_available);
reinit(); reinit();
} }
void SGTerraSync::shutdown()
{
_svnThread->stop();
}
void SGTerraSync::reinit() void SGTerraSync::reinit()
{ {
// do not reinit when enabled and we're already up and running // do not reinit when enabled and we're already up and running
+4 -1
View File
@@ -40,10 +40,11 @@ class SGTerraSync : public SGSubsystem
{ {
public: public:
SGTerraSync(SGPropertyNode_ptr root); SGTerraSync();
virtual ~SGTerraSync(); virtual ~SGTerraSync();
virtual void init(); virtual void init();
virtual void shutdown();
virtual void reinit(); virtual void reinit();
virtual void bind(); virtual void bind();
virtual void unbind(); virtual void unbind();
@@ -59,6 +60,8 @@ public:
bool scheduleTile(const SGBucket& bucket); bool scheduleTile(const SGBucket& bucket);
void setRoot(SGPropertyNode_ptr root);
/// retrive the associated log object, for displaying log /// retrive the associated log object, for displaying log
/// output somewhere (a UI, presumably) /// output somewhere (a UI, presumably)
BufferedLogCallback* log() const BufferedLogCallback* log() const