include/svx/svdetc.hxx                 |    9 ++++-----
 sd/source/ui/view/DocumentRenderer.cxx |    4 ++--
 svx/source/svdraw/svdetc.cxx           |   11 ++---------
 3 files changed, 8 insertions(+), 16 deletions(-)

New commits:
commit c46582de06f8d39cc4fc955578c221a29d57cc1a
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Feb 27 10:46:39 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Feb 27 14:43:53 2023 +0000

    return by ref from SdrGlobalData
    
    return values are never nullptr
    
    Change-Id: Id84fc6c8c63cdb34bdd8c07d8ff5b45f1bff2e48
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147873
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/include/svx/svdetc.hxx b/include/svx/svdetc.hxx
index 48ddb8bf86f0..9ae29efb5f06 100644
--- a/include/svx/svdetc.hxx
+++ b/include/svx/svdetc.hxx
@@ -186,12 +186,10 @@ public:
                         aUserMakeObjHdl;
     OLEObjCache         aOLEObjCache;
 
-
-    const SvtSysLocale* GetSysLocale() { return &maSysLocale;  } // follows 
always locale settings
-    const LocaleDataWrapper*    GetLocaleData();    // follows always SysLocale
-public:
     SdrGlobalData();
 
+    const SvtSysLocale& GetSysLocale() { return maSysLocale;  } // follows 
always locale settings
+    const LocaleDataWrapper& GetLocaleData();    // follows always SysLocale
     OLEObjCache&        GetOLEObjCache() { return aOLEObjCache; }
 };
 
diff --git a/sd/source/ui/view/DocumentRenderer.cxx 
b/sd/source/ui/view/DocumentRenderer.cxx
index 8ba5df1b948c..7ca62d9daa1b 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -1418,12 +1418,12 @@ private:
         // Collect some frequently used data.
         if (mpOptions->IsDate())
         {
-            aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getDate( 
Date( Date::SYSTEM ) );
+            aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData().getDate( 
Date( Date::SYSTEM ) );
             aInfo.msTimeDate += " ";
         }
 
         if (mpOptions->IsTime())
-            aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getTime( 
::tools::Time( ::tools::Time::SYSTEM ), false );
+            aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData().getTime( 
::tools::Time( ::tools::Time::SYSTEM ), false );
 
         // Draw and Notes should usually use specified paper size when printing
         if 
(!mpOptions->IsPrinterPreferred(mrBase.GetDocShell()->GetDocumentType()))
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index a5a83b475c59..41639002a143 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -68,9 +68,9 @@ SdrGlobalData::SdrGlobalData()
     }
 }
 
-const LocaleDataWrapper*    SdrGlobalData::GetLocaleData()
+const LocaleDataWrapper& SdrGlobalData::GetLocaleData()
 {
-    return &GetSysLocale()->GetLocaleData();
+    return GetSysLocale().GetLocaleData();
 }
 
 namespace {
commit da68460e03dc9857a24f2afeeb34f191f20f29ac
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Feb 27 10:39:22 2023 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Mon Feb 27 14:43:44 2023 +0000

    fix small leak in SdrGlobalData
    
    Change-Id: I2b651aad847cf083659df34c94653c73460ddfd3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147872
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/include/svx/svdetc.hxx b/include/svx/svdetc.hxx
index 266fba753f97..48ddb8bf86f0 100644
--- a/include/svx/svdetc.hxx
+++ b/include/svx/svdetc.hxx
@@ -26,6 +26,7 @@
 #include <tools/fract.hxx>
 #include <svx/svdobj.hxx>
 #include <svl/whichranges.hxx>
+#include <unotools/syslocale.hxx>
 #include <memory>
 
 
@@ -179,14 +180,14 @@ public:
 
 class SVXCORE_DLLPUBLIC SdrGlobalData
 {
-    const SvtSysLocale*         pSysLocale;     // follows always locale 
settings
+    SvtSysLocale  maSysLocale;     // follows always locale settings
 public:
     std::vector<Link<SdrObjCreatorParams, rtl::Reference<SdrObject>>>
                         aUserMakeObjHdl;
     OLEObjCache         aOLEObjCache;
 
 
-    const SvtSysLocale*         GetSysLocale();     // follows always locale 
settings
+    const SvtSysLocale* GetSysLocale() { return &maSysLocale;  } // follows 
always locale settings
     const LocaleDataWrapper*    GetLocaleData();    // follows always SysLocale
 public:
     SdrGlobalData();
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index b642f8e69117..a5a83b475c59 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -60,7 +60,6 @@ using namespace ::com::sun::star;
 
 // Global data of the DrawingEngine
 SdrGlobalData::SdrGlobalData()
-    : pSysLocale(nullptr)
 {
     if (!utl::ConfigManager::IsFuzzing())
     {
@@ -69,12 +68,6 @@ SdrGlobalData::SdrGlobalData()
     }
 }
 
-const SvtSysLocale*         SdrGlobalData::GetSysLocale()
-{
-    if ( !pSysLocale )
-        pSysLocale = new SvtSysLocale;
-    return pSysLocale;
-}
 const LocaleDataWrapper*    SdrGlobalData::GetLocaleData()
 {
     return &GetSysLocale()->GetLocaleData();

Reply via email to