From f9b68bafd90941d9faf53e5e2771361e3ab4336a Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 17 May 2016 16:00:28 +0200 Subject: Add sanity check --- include/astra/Singleton.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/astra/Singleton.h') diff --git a/include/astra/Singleton.h b/include/astra/Singleton.h index 1ef4bba..784c521 100644 --- a/include/astra/Singleton.h +++ b/include/astra/Singleton.h @@ -86,14 +86,14 @@ class Singleton { // libastra. This situation would cause issues when .mex files are unloaded. #define DEFINE_SINGLETON(T) \ -template<> void Singleton::construct() { m_singleton = new T(); } \ +template<> void Singleton::construct() { assert(!m_singleton); m_singleton = new T(); } \ template<> T* Singleton::m_singleton = 0 // This is a hack to support statements like // DEFINE_SINGLETON2(CTemplatedClass); #define DEFINE_SINGLETON2(A,B) \ -template<> void Singleton::construct() { m_singleton = new A,B(); } \ +template<> void Singleton::construct() { assert(!m_singleton); m_singleton = new A,B(); } \ template<> A,B* Singleton::m_singleton = 0 } // end namespace -- cgit v1.2.3