diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-03-31 15:54:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-04-02 14:53:48 +0100 |
commit | ae9219769106648ac35d594fc07c83103a62ecbe (patch) | |
tree | dbc21e302fe1808fc798c15156ad3a96418f5f45 /sw | |
parent | 437f93ec8d1cb0f1486c69b863cb509aea4dac65 (diff) |
remove static objects from static_initialization_and_destruction chain
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/dbui/mmconfigitem.cxx | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sw/source/ui/dbui/mmconfigitem.cxx b/sw/source/ui/dbui/mmconfigitem.cxx index 948af5e1f0a5..a8aa9271c275 100644 --- a/sw/source/ui/dbui/mmconfigitem.cxx +++ b/sw/source/ui/dbui/mmconfigitem.cxx @@ -43,6 +43,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/types.hxx> #include <com/sun/star/sdb/CommandType.hpp> +#include <rtl/instance.hxx> #include <unotools/configitem.hxx> #include <mailmergehelper.hxx> #include <swunohelper.hxx> @@ -736,9 +737,13 @@ void SwMailMergeConfigItem_Impl::SetCurrentGreeting( SetModified(); } -static SwMailMergeConfigItem_Impl* pOptions = NULL; -static sal_Int32 nRefCount = 0; -static ::osl::Mutex aMutex; +namespace +{ + static SwMailMergeConfigItem_Impl* pOptions = NULL; + static sal_Int32 nRefCount = 0; + + class theMailMergeConfigMutex : public rtl::Static<osl::Mutex, theMailMergeConfigMutex> {}; +} SwMailMergeConfigItem::SwMailMergeConfigItem() : m_bAddressInserted(false), @@ -751,7 +756,7 @@ SwMailMergeConfigItem::SwMailMergeConfigItem() : m_pTargetView(0) { // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( aMutex ); + ::osl::MutexGuard aGuard( theMailMergeConfigMutex::get() ); if ( !pOptions ) pOptions = new SwMailMergeConfigItem_Impl; ++nRefCount; @@ -761,7 +766,7 @@ SwMailMergeConfigItem::SwMailMergeConfigItem() : SwMailMergeConfigItem::~SwMailMergeConfigItem() { // Global access, must be guarded (multithreading) - ::osl::MutexGuard aGuard( aMutex ); + ::osl::MutexGuard aGuard( theMailMergeConfigMutex::get() ); if ( !--nRefCount ) { DELETEZ( pOptions ); |