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 /reportdesign/source | |
parent | e6409de0f879df204de7b07117798e2d77235458 (diff) |
remove static objects from static_initialization_and_destruction chain
Diffstat (limited to 'reportdesign/source')
-rw-r--r-- | reportdesign/source/core/sdr/ModuleHelper.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/reportdesign/source/core/sdr/ModuleHelper.cxx b/reportdesign/source/core/sdr/ModuleHelper.cxx index 9c78d9efc35d..58a286080f2d 100644 --- a/reportdesign/source/core/sdr/ModuleHelper.cxx +++ b/reportdesign/source/core/sdr/ModuleHelper.cxx @@ -32,13 +32,14 @@ #include <com/sun/star/util/XMacroExpander.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <rtl/instance.hxx> #include <rtl/uri.hxx> #include <tools/debug.hxx> #include <svl/solar.hrc> #define EXPAND_PROTOCOL "vnd.sun.star.expand:" #define ENTER_MOD_METHOD() \ - ::osl::MutexGuard aGuard(s_aMutex); \ + ::osl::MutexGuard aGuard(theOModuleMutex::get()); \ ensureImpl() //......................................................................... @@ -98,7 +99,13 @@ ResMgr* OModuleImpl::getResManager() //========================================================================= //= OModule //========================================================================= -::osl::Mutex OModule::s_aMutex; + +namespace +{ + // access safety + struct theOModuleMutex : public rtl::Static< osl::Mutex, theOModuleMutex > {}; +} + sal_Int32 OModule::s_nClients = 0; OModuleImpl* OModule::s_pImpl = NULL; //------------------------------------------------------------------------- @@ -111,14 +118,14 @@ ResMgr* OModule::getResManager() //------------------------------------------------------------------------- void OModule::registerClient() { - ::osl::MutexGuard aGuard(s_aMutex); + ::osl::MutexGuard aGuard(theOModuleMutex::get()); ++s_nClients; } //------------------------------------------------------------------------- void OModule::revokeClient() { - ::osl::MutexGuard aGuard(s_aMutex); + ::osl::MutexGuard aGuard(theOModuleMutex::get()); if (!--s_nClients && s_pImpl) { delete s_pImpl; |