summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-11 17:02:48 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-11 21:54:56 +0200
commite8d1824146027c708c6dd53cc8341c2677813cde (patch)
treee40f4dca1bf2bc20210f0933afdeeb38c07f4def
parent4cb85b20ae5a8ddda46b74382d60ec89b1b41320 (diff)
use unique_ptr for CalendarWrapper in ScGlobal
Change-Id: Id1a00798f9780006de28d3370e5bad1235fa2466 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100537 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sc/inc/global.hxx2
-rw-r--r--sc/source/core/data/global.cxx12
2 files changed, 7 insertions, 7 deletions
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index de0b3311c4fc..6d13efab4523 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -522,7 +522,7 @@ class ScGlobal
static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export
static css::uno::Reference< css::i18n::XOrdinalSuffix> xOrdinalSuffix;
- static CalendarWrapper* pCalendar;
+ static std::unique_ptr<CalendarWrapper> xCalendar;
static std::atomic<CollatorWrapper*> pCaseCollator;
static std::atomic<CollatorWrapper*> pCollator;
static std::atomic<::utl::TransliterationWrapper*> pTransliteration;
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 538702c87097..8b149300bbe3 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -80,7 +80,7 @@ ScUserList* ScGlobal::pUserList = nullptr;
LanguageType ScGlobal::eLnge = LANGUAGE_SYSTEM;
std::atomic<css::lang::Locale*> ScGlobal::pLocale(nullptr);
std::unique_ptr<SvtSysLocale> ScGlobal::xSysLocale;
-CalendarWrapper* ScGlobal::pCalendar = nullptr;
+std::unique_ptr<CalendarWrapper> ScGlobal::xCalendar;
std::atomic<CollatorWrapper*> ScGlobal::pCollator(nullptr);
std::atomic<CollatorWrapper*> ScGlobal::pCaseCollator(nullptr);
std::atomic<::utl::TransliterationWrapper*> ScGlobal::pTransliteration(nullptr);
@@ -548,7 +548,7 @@ void ScGlobal::Clear()
delete pTransliteration.load(); pTransliteration = nullptr;
delete pCaseCollator.load(); pCaseCollator = nullptr;
delete pCollator.load(); pCollator = nullptr;
- DELETEZ(pCalendar);
+ xCalendar.reset();
xSysLocale.reset();
delete pLocale.load(); pLocale = nullptr;
@@ -1025,12 +1025,12 @@ const CharClass* ScGlobal::getCharClassPtr()
CalendarWrapper* ScGlobal::GetCalendar()
{
assert(!bThreadedGroupCalcInProgress);
- if ( !pCalendar )
+ if ( !xCalendar )
{
- pCalendar = new CalendarWrapper( ::comphelper::getProcessComponentContext() );
- pCalendar->loadDefaultCalendar( *GetLocale() );
+ xCalendar.reset( new CalendarWrapper( ::comphelper::getProcessComponentContext() ) );
+ xCalendar->loadDefaultCalendar( *GetLocale() );
}
- return pCalendar;
+ return xCalendar.get();
}
CollatorWrapper* ScGlobal::GetCollator()
{