diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-04-02 09:38:26 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-04-02 14:53:50 +0100 |
commit | e9a467cafbffb380c54e90b24f9ee20cd4adc7e8 (patch) | |
tree | 9a5c6d4dcfdcb4ff7b089c0219d51e58c70146fc /dbaccess | |
parent | e6409de0f879df204de7b07117798e2d77235458 (diff) |
remove static objects from static_initialization_and_destruction chain
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/inc/core_resource.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/core/resource/core_resource.cxx | 13 |
2 files changed, 9 insertions, 5 deletions
diff --git a/dbaccess/source/core/inc/core_resource.hxx b/dbaccess/source/core/inc/core_resource.hxx index 42677cd5a72d..81e8bafc7056 100644 --- a/dbaccess/source/core/inc/core_resource.hxx +++ b/dbaccess/source/core/inc/core_resource.hxx @@ -51,7 +51,6 @@ namespace dbaccess class ResourceManager { friend class OModuleClient; - static ::osl::Mutex s_aMutex; /// access safety static sal_Int32 s_nClients; /// number of registered clients static ResMgr* m_pImpl; diff --git a/dbaccess/source/core/resource/core_resource.cxx b/dbaccess/source/core/resource/core_resource.cxx index fdaa168f3669..e42ad531aead 100644 --- a/dbaccess/source/core/resource/core_resource.cxx +++ b/dbaccess/source/core/resource/core_resource.cxx @@ -34,7 +34,7 @@ // ---- needed as long as we have no contexts for components --- #include <vcl/svapp.hxx> //--------------------------------------------------- - +#include <rtl/instance.hxx> #include <svl/solar.hrc> //......................................................................... @@ -44,7 +44,12 @@ namespace dbaccess //================================================================== //= ResourceManager //================================================================== - ::osl::Mutex ResourceManager::s_aMutex; + namespace + { + // access safety + struct theResourceManagerMutex : public rtl::Static< osl::Mutex, theResourceManagerMutex > {}; + } + sal_Int32 ResourceManager::s_nClients = 0; ResMgr* ResourceManager::m_pImpl = NULL; @@ -92,14 +97,14 @@ namespace dbaccess //------------------------------------------------------------------------- void ResourceManager::registerClient() { - ::osl::MutexGuard aGuard(s_aMutex); + ::osl::MutexGuard aGuard(theResourceManagerMutex::get()); ++s_nClients; } //------------------------------------------------------------------------- void ResourceManager::revokeClient() { - ::osl::MutexGuard aGuard(s_aMutex); + ::osl::MutexGuard aGuard(theResourceManagerMutex::get()); if (!--s_nClients && m_pImpl) { delete m_pImpl; |