From 7f9fdde77e60f4d2361a700ed846b88b7ee4d55f Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 11 Sep 2013 12:47:49 +0200 Subject: [PATCH] ido: Object map should not be static. --- lib/ido/dbtype.cpp | 15 +++------------ lib/ido/dbtype.h | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/lib/ido/dbtype.cpp b/lib/ido/dbtype.cpp index d283b8aba..b12b24b70 100644 --- a/lib/ido/dbtype.cpp +++ b/lib/ido/dbtype.cpp @@ -86,13 +86,13 @@ DbObject::Ptr DbType::GetOrCreateObjectByName(const String& name1, const String& ObjectLock olock(this); - DbType::ObjectMap::const_iterator it = GetObjects().find(std::make_pair(name1, name2)); + DbType::ObjectMap::const_iterator it = m_Objects.find(std::make_pair(name1, name2)); - if (it != GetObjects().end()) + if (it != m_Objects.end()) return it->second; DbObject::Ptr dbobj = m_ObjectFactory(GetSelf(), name1, name2); - GetObjects()[std::make_pair(name1, name2)] = dbobj; + m_Objects[std::make_pair(name1, name2)] = dbobj; return dbobj; } @@ -111,12 +111,3 @@ DbType::TypeMap& DbType::GetTypes(void) static DbType::TypeMap tm; return tm; } - -/** - * Caller must hold object mutex. - */ -DbType::ObjectMap& DbType::GetObjects(void) -{ - static DbType::ObjectMap om; - return om; -} diff --git a/lib/ido/dbtype.h b/lib/ido/dbtype.h index ed0e00cc7..847784293 100644 --- a/lib/ido/dbtype.h +++ b/lib/ido/dbtype.h @@ -67,7 +67,7 @@ private: static boost::mutex& GetStaticMutex(void); static TypeMap& GetTypes(void); - ObjectMap& GetObjects(void); + ObjectMap m_Objects; }; /** -- 2.40.0