From ae9219769106648ac35d594fc07c83103a62ecbe Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 31 Mar 2012 15:54:07 +0100 Subject: remove static objects from static_initialization_and_destruction chain --- sw/source/ui/dbui/mmconfigitem.cxx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'sw') 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 #include #include +#include #include #include #include @@ -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 {}; +} 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 ); -- cgit