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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 12 08:16:58 UTC 2020


 compilerplugins/clang/badstatics.cxx |    2 +-
 sc/inc/global.hxx                    |    2 +-
 sc/source/core/data/global.cxx       |   10 +++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 361c46fdcc18840f673bd65224d1542ea570d73d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 11 17:26:26 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Aug 12 10:16:22 2020 +0200

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

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<css::lang::Locale*>   pLocale;
 
-    static ScFieldEditEngine*   pFieldEditEngine;
+    static std::unique_ptr<ScFieldEditEngine> 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<ScFunctionMgr> ScGlobal::xStarCalcFunctionMgr;
 
 std::atomic<ScUnitConverter*> ScGlobal::pUnitConverter(nullptr);
 std::unique_ptr<SvNumberFormatter> ScGlobal::xEnglishFormatter;
-ScFieldEditEngine* ScGlobal::pFieldEditEngine = nullptr;
+std::unique_ptr<ScFieldEditEngine> 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,


More information about the Libreoffice-commits mailing list