summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2016-11-11 23:38:17 +0100
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-11-12 06:38:34 +0000
commit73679ee0a31e3f70ace5136a8e41cbeb1f00c238 (patch)
tree4fbecf9f667b619f4e8a413592d0e61a191062b9 /unotools
parent545f5f8abd1df1f9818fbc62c95006149bcc18ef (diff)
Copycat SvtSysLocale_Impl for SvtSysLocaleOptions_Impl
and so avoid warn:unotools.config:6728:1:unotools/source/config/configmgr.cxx:167: ConfigManager not empty when exiting LO See http://nabble.documentfoundation.org/OSL-ASSERT-items-empty-because-of-Setup-L10N-td4199284.html Thank you Eike for the hint! Change-Id: I4b374a075ad8f1ef10a71f3a9424986154613aef Reviewed-on: https://gerrit.libreoffice.org/30787 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/config/syslocaleoptions.cxx54
1 files changed, 25 insertions, 29 deletions
diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index b3d7647911a4..9b24977f949c 100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -38,10 +38,9 @@ using namespace utl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
-SvtSysLocaleOptions_Impl* SvtSysLocaleOptions::pOptions = nullptr;
-sal_Int32 SvtSysLocaleOptions::nRefCount = 0;
namespace
{
+ std::weak_ptr<SvtSysLocaleOptions_Impl> g_pSysLocaleOptions;
struct CurrencyChangeLink
: public rtl::Static<Link<LinkParamNone*,void>, CurrencyChangeLink> {};
}
@@ -513,25 +512,22 @@ void SvtSysLocaleOptions_Impl::Notify( const Sequence< OUString >& seqPropertyNa
SvtSysLocaleOptions::SvtSysLocaleOptions()
{
MutexGuard aGuard( GetMutex() );
- if ( !pOptions )
+ pImpl = g_pSysLocaleOptions.lock();
+ if ( !pImpl )
{
- pOptions = new SvtSysLocaleOptions_Impl;
+ pImpl = std::make_shared<SvtSysLocaleOptions_Impl>();
+ g_pSysLocaleOptions = pImpl;
if (!utl::ConfigManager::IsAvoidConfig())
ItemHolder1::holdConfigItem(E_SYSLOCALEOPTIONS);
}
- ++nRefCount;
- pOptions->AddListener(this);
+ pImpl->AddListener(this);
}
SvtSysLocaleOptions::~SvtSysLocaleOptions()
{
MutexGuard aGuard( GetMutex() );
- pOptions->RemoveListener(this);
- if ( !--nRefCount )
- {
- delete pOptions;
- pOptions = nullptr;
- }
+ pImpl->RemoveListener(this);
+ pImpl.reset();
}
// static
@@ -555,91 +551,91 @@ Mutex& SvtSysLocaleOptions::GetMutex()
bool SvtSysLocaleOptions::IsModified()
{
MutexGuard aGuard( GetMutex() );
- return pOptions->IsModified();
+ return pImpl->IsModified();
}
void SvtSysLocaleOptions::Commit()
{
MutexGuard aGuard( GetMutex() );
- pOptions->Commit();
+ pImpl->Commit();
}
void SvtSysLocaleOptions::BlockBroadcasts( bool bBlock )
{
MutexGuard aGuard( GetMutex() );
- pOptions->BlockBroadcasts( bBlock );
+ pImpl->BlockBroadcasts( bBlock );
}
const OUString& SvtSysLocaleOptions::GetLocaleConfigString() const
{
MutexGuard aGuard( GetMutex() );
- return pOptions->GetLocaleString();
+ return pImpl->GetLocaleString();
}
void SvtSysLocaleOptions::SetLocaleConfigString( const OUString& rStr )
{
MutexGuard aGuard( GetMutex() );
- pOptions->SetLocaleString( rStr );
+ pImpl->SetLocaleString( rStr );
}
void SvtSysLocaleOptions::SetUILocaleConfigString( const OUString& rStr )
{
MutexGuard aGuard( GetMutex() );
- pOptions->SetUILocaleString( rStr );
+ pImpl->SetUILocaleString( rStr );
}
const OUString& SvtSysLocaleOptions::GetCurrencyConfigString() const
{
MutexGuard aGuard( GetMutex() );
- return pOptions->GetCurrencyString();
+ return pImpl->GetCurrencyString();
}
void SvtSysLocaleOptions::SetCurrencyConfigString( const OUString& rStr )
{
MutexGuard aGuard( GetMutex() );
- pOptions->SetCurrencyString( rStr );
+ pImpl->SetCurrencyString( rStr );
}
const OUString& SvtSysLocaleOptions::GetDatePatternsConfigString() const
{
MutexGuard aGuard( GetMutex() );
- return pOptions->GetDatePatternsString();
+ return pImpl->GetDatePatternsString();
}
void SvtSysLocaleOptions::SetDatePatternsConfigString( const OUString& rStr )
{
MutexGuard aGuard( GetMutex() );
- pOptions->SetDatePatternsString( rStr );
+ pImpl->SetDatePatternsString( rStr );
}
bool SvtSysLocaleOptions::IsDecimalSeparatorAsLocale() const
{
MutexGuard aGuard( GetMutex() );
- return pOptions->IsDecimalSeparatorAsLocale();
+ return pImpl->IsDecimalSeparatorAsLocale();
}
void SvtSysLocaleOptions::SetDecimalSeparatorAsLocale( bool bSet)
{
MutexGuard aGuard( GetMutex() );
- pOptions->SetDecimalSeparatorAsLocale(bSet);
+ pImpl->SetDecimalSeparatorAsLocale(bSet);
}
bool SvtSysLocaleOptions::IsIgnoreLanguageChange() const
{
MutexGuard aGuard( GetMutex() );
- return pOptions->IsIgnoreLanguageChange();
+ return pImpl->IsIgnoreLanguageChange();
}
void SvtSysLocaleOptions::SetIgnoreLanguageChange( bool bSet)
{
MutexGuard aGuard( GetMutex() );
- pOptions->SetIgnoreLanguageChange(bSet);
+ pImpl->SetIgnoreLanguageChange(bSet);
}
bool SvtSysLocaleOptions::IsReadOnly( EOption eOption ) const
{
MutexGuard aGuard( GetMutex() );
- return pOptions->IsReadOnly( eOption );
+ return pImpl->IsReadOnly( eOption );
}
// static
@@ -711,12 +707,12 @@ LanguageTag SvtSysLocaleOptions::GetLanguageTag() const
const LanguageTag & SvtSysLocaleOptions::GetRealLanguageTag() const
{
- return pOptions->GetRealLocale();
+ return pImpl->GetRealLocale();
}
const LanguageTag & SvtSysLocaleOptions::GetRealUILanguageTag() const
{
- return pOptions->GetRealUILocale();
+ return pImpl->GetRealUILocale();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */