[Libreoffice-commits] core.git: include/svx svx/source

Caolán McNamara caolanm at redhat.com
Mon Sep 25 07:54:53 UTC 2017


 include/svx/svdetc.hxx       |   28 ++++++----------------------
 svx/source/svdraw/svdetc.cxx |   22 +++-------------------
 2 files changed, 9 insertions(+), 41 deletions(-)

New commits:
commit 4d5e9db574bdb1a7517ffda01efe0746cc058d47
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Sep 24 21:10:56 2017 +0100

    Related: tdf#112388 last Fraction leak
    
    This SdrEngineDefaults never changes its initial Fraction or Color
    and always returns a copy, so drop all the complicated stuff
    
    Change-Id: Ic26d221be022f4d1e75498eca675b4aae1c020f1
    Reviewed-on: https://gerrit.libreoffice.org/42723
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svx/svdetc.hxx b/include/svx/svdetc.hxx
index 33e6a8fbeec1..ef62a825245a 100644
--- a/include/svx/svdetc.hxx
+++ b/include/svx/svdetc.hxx
@@ -62,39 +62,24 @@ SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel&
  * One should set these default settings as the first
  * thing at program start, before any other method is called.
  */
-class SVX_DLLPUBLIC SdrEngineDefaults
+namespace SdrEngineDefaults
 {
-friend class SdrAttrObj;
-    Color            aFontColor;
-    Fraction         aMapFraction;
-
-private:
-    static SdrEngineDefaults& GetDefaults();
-
-public:
-    SdrEngineDefaults();
-
-    // Default FontColor is COL_BLACK
-    static Color      GetFontColor()                       { return GetDefaults().aFontColor; }
+    // Default FontColor is COL_AUTO
+    inline Color GetFontColor() { return COL_AUTO; }
 
     // Default FontHeight is 847. The font height uses logical units (MapUnit/MapFraction
     // see below for further details). The default setting 847/100mm corresponds to about
     // 24 Point. If e.g. one would use Twips (SetMapUnit(MapUnit::MapTwip)) (20 Twip = 1 Point)
     // instead, one would need to set the font height to 480, in order to get a 24 Point height.
-    static size_t      GetFontHeight()                      { return 847; }
+    inline size_t GetFontHeight() { return 847; }
 
     // The MapMode is needed for the global Outliner.
     // Incidentally, every newly instantiated SdrModel is assigned this MapMode by default.
     // Default MapUnit is MapUnit::Map100thMM
-    static MapUnit    GetMapUnit()                         { return MapUnit::Map100thMM; }
+    inline MapUnit GetMapUnit() { return MapUnit::Map100thMM; }
 
     // Default MapFraction is 1/1.
-    static Fraction   GetMapFraction()                     { return GetDefaults().aMapFraction; }
-
-    // Create an Outliner with the engine-global default values on the heap.
-    // If pMod != nullptr, the MapMode of the passed model is used.
-    // The resulting default font height, however, stays the same (the logical font height is converted).
-    friend SVX_DLLPUBLIC SdrOutliner* SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel& rMod);
+    inline Fraction GetMapFraction() { return Fraction(1, 1); }
 };
 
 class SfxItemSet;
@@ -202,7 +187,6 @@ class SVX_DLLPUBLIC SdrGlobalData
 public:
     std::vector<Link<SdrObjCreatorParams, SdrObject*>>
                         aUserMakeObjHdl;
-    SdrEngineDefaults*  pDefaults;
     OLEObjCache         aOLEObjCache;
 
 
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 3cc369a49be5..f866ace9b8db 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -68,10 +68,9 @@
 using namespace ::com::sun::star;
 
 // Global data of the DrawingEngine
-SdrGlobalData::SdrGlobalData() :
-    pSysLocale(nullptr),
-    pLocaleData(nullptr),
-    pDefaults(nullptr)
+SdrGlobalData::SdrGlobalData()
+    : pSysLocale(nullptr)
+    , pLocaleData(nullptr)
 {
     if (!utl::ConfigManager::IsAvoidConfig())
     {
@@ -334,21 +333,6 @@ bool GetDraftFillColor(const SfxItemSet& rSet, Color& rCol)
     return bRetval;
 }
 
-SdrEngineDefaults::SdrEngineDefaults():
-    aFontColor(COL_AUTO),
-    aMapFraction(1,1)
-{
-}
-
-SdrEngineDefaults& SdrEngineDefaults::GetDefaults()
-{
-    SdrGlobalData& rGlobalData=GetSdrGlobalData();
-    if (rGlobalData.pDefaults==nullptr) {
-        rGlobalData.pDefaults=new SdrEngineDefaults;
-    }
-    return *rGlobalData.pDefaults;
-}
-
 SdrOutliner* SdrMakeOutliner(OutlinerMode nOutlinerMode, SdrModel& rModel)
 {
     SfxItemPool* pPool = &rModel.GetItemPool();


More information about the Libreoffice-commits mailing list