From 273d3366805a7022ad99a58dba172954a363b895 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 6 Jun 2015 22:50:00 +0100 Subject: Non-static ICE proxy and destroy the local communicator handle --- project2/common/dataSource.cpp | 4 ---- project2/common/dataSource.h | 2 +- project2/ice/iceDataSource.cpp | 7 +++++-- project2/ice/iceDataSource.h | 3 ++- project2/ice/unittests/testDaemon.cpp | 1 + 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/project2/common/dataSource.cpp b/project2/common/dataSource.cpp index 133f64d..b5760c5 100644 --- a/project2/common/dataSource.cpp +++ b/project2/common/dataSource.cpp @@ -7,7 +7,3 @@ DataSource::DataSource(ScriptNodePtr p) : { } -DataSource::~DataSource() -{ -} - diff --git a/project2/common/dataSource.h b/project2/common/dataSource.h index 063d33e..bd7170f 100644 --- a/project2/common/dataSource.h +++ b/project2/common/dataSource.h @@ -11,7 +11,7 @@ typedef boost::intrusive_ptr DataSourcePtr; class DataSource : public SourceObject { public: DataSource(ScriptNodePtr p); - virtual ~DataSource(); + virtual ~DataSource() = default; virtual void close() { }; virtual void commit() { }; diff --git a/project2/ice/iceDataSource.cpp b/project2/ice/iceDataSource.cpp index 7871500..aa033fc 100644 --- a/project2/ice/iceDataSource.cpp +++ b/project2/ice/iceDataSource.cpp @@ -7,7 +7,6 @@ #include "appInstance.h" IceBase::Libs IceDataSource::libs; -IceDataSource::Proxies IceDataSource::proxies; DECLARE_OPTIONS(IceDataSource, "ICE Data Source") ("ice.client.slice", Options::functions(boost::bind(&IceBase::SetSlice, boost::ref(IceDataSource::libs), &IceDataSource::GetComponentCompiler, _1, true, true), boost::bind(&IceDataSource::ClearSlice)), @@ -27,6 +26,11 @@ IceDataSource::IceDataSource(ScriptNodePtr p) : Logger()->messagebf(LOG_DEBUG, "%s: endpoint: %s", __PRETTY_FUNCTION__, endpoint(NULL)); } +IceDataSource::~IceDataSource() +{ + ic->destroy(); +} + IceCompile::Ptr IceDataSource::GetComponentCompiler(const std::string & slice, const IceCompile::Deps & deps) { @@ -38,7 +42,6 @@ IceDataSource::ClearSlice() { AppInstance::current().clearScriptCache(); libs.clear(); - proxies.clear(); } class IceDataSourceLoader : public ElementLoader::For { diff --git a/project2/ice/iceDataSource.h b/project2/ice/iceDataSource.h index fa0c92a..715f27b 100644 --- a/project2/ice/iceDataSource.h +++ b/project2/ice/iceDataSource.h @@ -12,6 +12,7 @@ class IceDataSource : public DataSource, IceBase { INITOPTIONS; IceDataSource(ScriptNodePtr p); + ~IceDataSource(); template Interface GetProxy(const std::string object, ExecContext * ec) const @@ -35,7 +36,7 @@ class IceDataSource : public DataSource, IceBase { const Ice::CommunicatorPtr ic; typedef std::map Proxies; - static Proxies proxies; + mutable Proxies proxies; }; #endif diff --git a/project2/ice/unittests/testDaemon.cpp b/project2/ice/unittests/testDaemon.cpp index 3ca9261..0740966 100644 --- a/project2/ice/unittests/testDaemon.cpp +++ b/project2/ice/unittests/testDaemon.cpp @@ -186,6 +186,7 @@ commonTests() id->shutdown(); run.join(); + ic->destroy(); } static -- cgit v1.2.3