diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx index e50a8df3ccda..3f4d6cddecd3 100644 --- a/compilerplugins/clang/badstatics.cxx +++ b/compilerplugins/clang/badstatics.cxx @@ -176,7 +176,7 @@ public: || name == "g_pSpellIter" // SwEditShell::SpellEnd() || name == "g_pConvIter" // SwEditShell::SpellEnd() || name == "g_pHyphIter" // SwEditShell::HyphEnd() - || name == "pFieldEditEngine" // ScGlobal::Clear() + || name == "xFieldEditEngine" // ScGlobal::Clear() || name == "xDrawClipDocShellRef" // ScGlobal::Clear() || name == "s_ImageTree" // ImageTree::get(), ImageTree::shutDown() diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 95ec2efda5c6..580c9aa8eb56 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -528,7 +528,7 @@ class ScGlobal static std::atomic<::utl::TransliterationWrapper*> pCaseTransliteration; static std::atomic pLocale; - static ScFieldEditEngine* pFieldEditEngine; + static std::unique_ptr xFieldEditEngine; static void InitPPT(); diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index ae9606b9c665..0c044fc4aeb5 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -98,7 +98,7 @@ std::unique_ptr ScGlobal::xStarCalcFunctionMgr; std::atomic ScGlobal::pUnitConverter(nullptr); std::unique_ptr ScGlobal::xEnglishFormatter; -ScFieldEditEngine* ScGlobal::pFieldEditEngine = nullptr; +std::unique_ptr ScGlobal::xFieldEditEngine; double ScGlobal::nScreenPPTX = 96.0; double ScGlobal::nScreenPPTY = 96.0; @@ -550,7 +550,7 @@ void ScGlobal::Clear() delete pLocale.load(); pLocale = nullptr; delete pUnitConverter.load(); pUnitConverter = nullptr; - DELETEZ(pFieldEditEngine); + xFieldEditEngine.reset(); xDrawClipDocShellRef.clear(); } @@ -1058,15 +1058,15 @@ css::lang::Locale* ScGlobal::GetLocale() ScFieldEditEngine& ScGlobal::GetStaticFieldEditEngine() { assert(!bThreadedGroupCalcInProgress); - if (!pFieldEditEngine) + if (!xFieldEditEngine) { // Creating a ScFieldEditEngine with pDocument=NULL leads to document // specific fields not being resolvable! See // ScFieldEditEngine::CalcFieldValue(). pEnginePool=NULL lets // EditEngine internally create and delete a default pool. - pFieldEditEngine = new ScFieldEditEngine( nullptr, nullptr); + xFieldEditEngine.reset(new ScFieldEditEngine( nullptr, nullptr)); } - return *pFieldEditEngine; + return *xFieldEditEngine; } OUString ScGlobal::ReplaceOrAppend( const OUString& rString,