summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libadhocutil/globalStatic.h2
-rw-r--r--libadhocutil/globalStatic.impl.h7
-rw-r--r--libadhocutil/unittests/testPlugins.cpp1
3 files changed, 5 insertions, 5 deletions
diff --git a/libadhocutil/globalStatic.h b/libadhocutil/globalStatic.h
index 5808551..3639237 100644
--- a/libadhocutil/globalStatic.h
+++ b/libadhocutil/globalStatic.h
@@ -18,7 +18,7 @@ namespace AdHoc {
static Object * get();
private:
- typedef std::unique_ptr<Object> Ptr;
+ using Ptr = Object *;
static void createObject() __attribute__((constructor(101)));
static void deleteObject() __attribute__((destructor(101)));
diff --git a/libadhocutil/globalStatic.impl.h b/libadhocutil/globalStatic.impl.h
index fcd8096..13f2f72 100644
--- a/libadhocutil/globalStatic.impl.h
+++ b/libadhocutil/globalStatic.impl.h
@@ -7,19 +7,20 @@ namespace AdHoc {
template<typename Object>
Object * GlobalStatic<Object>::get()
{
- return instance().get();
+ return instance();
}
template<typename Object>
void GlobalStatic<Object>::createObject()
{
- instance() = std::make_unique<Object>();
+ instance() = new Object();
}
template<typename Object>
void GlobalStatic<Object>::deleteObject()
{
- instance().reset();
+ delete instance();
+ instance() = nullptr;
}
template<typename Object>
diff --git a/libadhocutil/unittests/testPlugins.cpp b/libadhocutil/unittests/testPlugins.cpp
index a8380fb..8d35822 100644
--- a/libadhocutil/unittests/testPlugins.cpp
+++ b/libadhocutil/unittests/testPlugins.cpp
@@ -79,7 +79,6 @@ BOOST_AUTO_TEST_CASE( createAndRemove )
auto c1 = PluginManager::getDefault()->get<BaseThing>("custom1");
BOOST_REQUIRE(c1);
PluginManager::getDefault()->remove<BaseThing>("custom1");
-
}
BOOST_AUTO_TEST_CASE( nameAndTypeClash )