sc/inc/global.hxx              |    2 +-
 sc/source/core/data/global.cxx |   12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit e8d1824146027c708c6dd53cc8341c2677813cde
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Aug 11 17:02:48 2020 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 11 21:54:56 2020 +0200

    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.gran...@collabora.co.uk>

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()
 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to