use unique_ptr for ScFunctionMgr
Change-Id: Ida42bf61e7fe4e2775e7a95c4eca7d03947bf3a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100535 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -515,7 +515,7 @@ class ScGlobal
|
|||||||
static std::unique_ptr<SvxBrushItem> xEmbeddedBrushItem;
|
static std::unique_ptr<SvxBrushItem> xEmbeddedBrushItem;
|
||||||
|
|
||||||
static ScFunctionList* pStarCalcFunctionList;
|
static ScFunctionList* pStarCalcFunctionList;
|
||||||
static ScFunctionMgr* pStarCalcFunctionMgr;
|
static std::unique_ptr<ScFunctionMgr> xStarCalcFunctionMgr;
|
||||||
|
|
||||||
static std::atomic<ScUnitConverter*> pUnitConverter;
|
static std::atomic<ScUnitConverter*> pUnitConverter;
|
||||||
|
|
||||||
|
@@ -94,7 +94,7 @@ std::unique_ptr<SvxBrushItem> ScGlobal::xButtonBrushItem;
|
|||||||
std::unique_ptr<SvxBrushItem> ScGlobal::xEmbeddedBrushItem;
|
std::unique_ptr<SvxBrushItem> ScGlobal::xEmbeddedBrushItem;
|
||||||
|
|
||||||
ScFunctionList* ScGlobal::pStarCalcFunctionList = nullptr;
|
ScFunctionList* ScGlobal::pStarCalcFunctionList = nullptr;
|
||||||
ScFunctionMgr* ScGlobal::pStarCalcFunctionMgr = nullptr;
|
std::unique_ptr<ScFunctionMgr> ScGlobal::xStarCalcFunctionMgr;
|
||||||
|
|
||||||
std::atomic<ScUnitConverter*> ScGlobal::pUnitConverter(nullptr);
|
std::atomic<ScUnitConverter*> ScGlobal::pUnitConverter(nullptr);
|
||||||
SvNumberFormatter* ScGlobal::pEnglishFormatter = nullptr;
|
SvNumberFormatter* ScGlobal::pEnglishFormatter = nullptr;
|
||||||
@@ -535,7 +535,7 @@ void ScGlobal::Clear()
|
|||||||
delete pAddInCollection.load(); pAddInCollection = nullptr;
|
delete pAddInCollection.load(); pAddInCollection = nullptr;
|
||||||
DELETEZ(pUserList);
|
DELETEZ(pUserList);
|
||||||
DELETEZ(pStarCalcFunctionList); // Destroy before ResMgr!
|
DELETEZ(pStarCalcFunctionList); // Destroy before ResMgr!
|
||||||
DELETEZ(pStarCalcFunctionMgr);
|
xStarCalcFunctionMgr.reset();
|
||||||
ScParameterClassification::Exit();
|
ScParameterClassification::Exit();
|
||||||
ScCompiler::DeInit();
|
ScCompiler::DeInit();
|
||||||
ScInterpreter::GlobalExit(); // Delete static Stack
|
ScInterpreter::GlobalExit(); // Delete static Stack
|
||||||
@@ -626,16 +626,16 @@ ScFunctionList* ScGlobal::GetStarCalcFunctionList()
|
|||||||
ScFunctionMgr* ScGlobal::GetStarCalcFunctionMgr()
|
ScFunctionMgr* ScGlobal::GetStarCalcFunctionMgr()
|
||||||
{
|
{
|
||||||
assert(!bThreadedGroupCalcInProgress);
|
assert(!bThreadedGroupCalcInProgress);
|
||||||
if ( !pStarCalcFunctionMgr )
|
if ( !xStarCalcFunctionMgr )
|
||||||
pStarCalcFunctionMgr = new ScFunctionMgr;
|
xStarCalcFunctionMgr.reset(new ScFunctionMgr);
|
||||||
|
|
||||||
return pStarCalcFunctionMgr;
|
return xStarCalcFunctionMgr.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScGlobal::ResetFunctionList()
|
void ScGlobal::ResetFunctionList()
|
||||||
{
|
{
|
||||||
// FunctionMgr has pointers into FunctionList, must also be updated
|
// FunctionMgr has pointers into FunctionList, must also be updated
|
||||||
DELETEZ( pStarCalcFunctionMgr );
|
xStarCalcFunctionMgr.reset();
|
||||||
DELETEZ( pStarCalcFunctionList );
|
DELETEZ( pStarCalcFunctionList );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user