[Libreoffice-commits] core.git: sc/inc sc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 12 06:57:34 UTC 2020


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

New commits:
commit c6d3e81669124caff72f32ec901f96f8303c069e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 11 16:50:15 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 12 08:56:48 2020 +0200

    use unique_ptr for ScFunctionList
    
    Change-Id: Ic198c36e1a39d8c56c9720d3d5a945d3415f06d4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100536
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index adf294cdeaba..44b35c003fc1 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -514,7 +514,7 @@ class ScGlobal
     static std::unique_ptr<SvxBrushItem> xButtonBrushItem;
     static std::unique_ptr<SvxBrushItem> xEmbeddedBrushItem;
 
-    static ScFunctionList*  pStarCalcFunctionList;
+    static std::unique_ptr<ScFunctionList> xStarCalcFunctionList;
     static std::unique_ptr<ScFunctionMgr> xStarCalcFunctionMgr;
 
     static std::atomic<ScUnitConverter*> pUnitConverter;
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 1212ad56fb37..0fc9977ce7f7 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -93,7 +93,7 @@ std::unique_ptr<SvxBrushItem> ScGlobal::xEmptyBrushItem;
 std::unique_ptr<SvxBrushItem> ScGlobal::xButtonBrushItem;
 std::unique_ptr<SvxBrushItem> ScGlobal::xEmbeddedBrushItem;
 
-ScFunctionList* ScGlobal::pStarCalcFunctionList = nullptr;
+std::unique_ptr<ScFunctionList> ScGlobal::xStarCalcFunctionList;
 std::unique_ptr<ScFunctionMgr> ScGlobal::xStarCalcFunctionMgr;
 
 std::atomic<ScUnitConverter*> ScGlobal::pUnitConverter(nullptr);
@@ -534,7 +534,7 @@ void ScGlobal::Clear()
     delete pLegacyFuncCollection.load(); pLegacyFuncCollection = nullptr;
     delete pAddInCollection.load(); pAddInCollection = nullptr;
     DELETEZ(pUserList);
-    DELETEZ(pStarCalcFunctionList); // Destroy before ResMgr!
+    xStarCalcFunctionList.reset(); // Destroy before ResMgr!
     xStarCalcFunctionMgr.reset();
     ScParameterClassification::Exit();
     ScCompiler::DeInit();
@@ -611,16 +611,16 @@ OUString ScGlobal::GetCharsetString( rtl_TextEncoding eVal )
 
 bool ScGlobal::HasStarCalcFunctionList()
 {
-    return ( pStarCalcFunctionList != nullptr );
+    return bool(xStarCalcFunctionList);
 }
 
 ScFunctionList* ScGlobal::GetStarCalcFunctionList()
 {
     assert(!bThreadedGroupCalcInProgress);
-    if ( !pStarCalcFunctionList )
-        pStarCalcFunctionList = new ScFunctionList;
+    if ( !xStarCalcFunctionList )
+        xStarCalcFunctionList.reset(new ScFunctionList);
 
-    return pStarCalcFunctionList;
+    return xStarCalcFunctionList.get();
 }
 
 ScFunctionMgr* ScGlobal::GetStarCalcFunctionMgr()
@@ -636,7 +636,7 @@ void ScGlobal::ResetFunctionList()
 {
     // FunctionMgr has pointers into FunctionList, must also be updated
     xStarCalcFunctionMgr.reset();
-    DELETEZ( pStarCalcFunctionList );
+    xStarCalcFunctionList.reset();
 }
 
 ScUnitConverter* ScGlobal::GetUnitConverter()


More information about the Libreoffice-commits mailing list