From c6d3e81669124caff72f32ec901f96f8303c069e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 11 Aug 2020 16:50:15 +0200 Subject: use unique_ptr for ScFunctionList Change-Id: Ic198c36e1a39d8c56c9720d3d5a945d3415f06d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100536 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/inc/global.hxx | 2 +- sc/source/core/data/global.cxx | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'sc') 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 xButtonBrushItem; static std::unique_ptr xEmbeddedBrushItem; - static ScFunctionList* pStarCalcFunctionList; + static std::unique_ptr xStarCalcFunctionList; static std::unique_ptr xStarCalcFunctionMgr; static std::atomic 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 ScGlobal::xEmptyBrushItem; std::unique_ptr ScGlobal::xButtonBrushItem; std::unique_ptr ScGlobal::xEmbeddedBrushItem; -ScFunctionList* ScGlobal::pStarCalcFunctionList = nullptr; +std::unique_ptr ScGlobal::xStarCalcFunctionList; std::unique_ptr ScGlobal::xStarCalcFunctionMgr; std::atomic 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() -- cgit