summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-11 16:50:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-12 08:56:48 +0200
commitc6d3e81669124caff72f32ec901f96f8303c069e (patch)
tree0e29d3476ac3dd651b9008e329372db035225502 /sc
parentaa5da4850b0024e521aaf9d3324c2e755c5f65d4 (diff)
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@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/global.hxx2
-rw-r--r--sc/source/core/data/global.cxx14
2 files changed, 8 insertions, 8 deletions
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()