diff --git a/lib/base/singleton.h b/lib/base/singleton.h index 4f65da04a..573daabca 100644 --- a/lib/base/singleton.h +++ b/lib/base/singleton.h @@ -38,20 +38,17 @@ public: static boost::mutex mutex; boost::mutex::scoped_lock lock(mutex); - if (!m_Instance) - m_Instance = new T(); + static T *instance = NULL; - return m_Instance; + if (!instance) + instance = new T(); + + return instance; } private: friend T *T::GetInstance(void); - - static T *m_Instance; }; -template -T *Singleton::m_Instance = NULL; - } #endif /* SINGLETON_H */