summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-06-06 13:23:35 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-06-14 11:05:22 +0000
commit3db4830c4137563f68c92aef4a31f2a39ac00748 (patch)
treeb06f4e3b9d7281d30fa1b82111710b19ae94f567 /unotools
parent60e57960f25202f7b23bf4dbbda46780fb6032a9 (diff)
tdf#89329: use shared_ptr for pImpl in syslocale
Change-Id: I646495e3538cb438a06765fe8cde252bad667bea Reviewed-on: https://gerrit.libreoffice.org/25969 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'unotools')
-rw-r--r--unotools/source/misc/syslocale.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx
index e93e620a5049..b0cef62e7ee9 100644
--- a/unotools/source/misc/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -34,8 +34,7 @@
using namespace osl;
using namespace com::sun::star;
-SvtSysLocale_Impl* SvtSysLocale::pImpl = nullptr;
-sal_Int32 SvtSysLocale::nRefCount = 0;
+std::weak_ptr<SvtSysLocale_Impl> pSysLocale;
class SvtSysLocale_Impl : public utl::ConfigurationListener
{
@@ -114,19 +113,18 @@ void SvtSysLocale_Impl::setDateAcceptancePatternsConfig()
SvtSysLocale::SvtSysLocale()
{
MutexGuard aGuard( GetMutex() );
+ pImpl = pSysLocale.lock();
if ( !pImpl )
- pImpl = new SvtSysLocale_Impl;
- ++nRefCount;
+ {
+ pImpl = std::make_shared<SvtSysLocale_Impl>();
+ pSysLocale = pImpl;
+ }
}
SvtSysLocale::~SvtSysLocale()
{
MutexGuard aGuard( GetMutex() );
- if ( !--nRefCount )
- {
- delete pImpl;
- pImpl = nullptr;
- }
+ pImpl.reset();
}
// static