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

Jochen Nitschke j.nitschke+logerrit at ok.de
Sun Sep 4 09:06:57 UTC 2016


 chart2/source/view/main/ChartItemPool.cxx |   15 ++++-----------
 chart2/source/view/main/ChartItemPool.hxx |    1 -
 svx/source/svdraw/svdattr.cxx             |   17 -----------------
 svx/source/xoutdev/xpool.cxx              |   18 ++----------------
 4 files changed, 6 insertions(+), 45 deletions(-)

New commits:
commit 4d0b71be75804dd2b008d3da932d620893fbd780
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Sat Sep 3 16:17:41 2016 +0200

    remove reimplementations of SfxItemPool::ReleaseDefaults()
    
    use method from base class SfxItemPool to release and remove the
    static pool of default items.
    SdrItemPool is child of XOutdevItemPool using the same static pool,
    no need for own code in dtor.
    
    ~SfxItemPool has a Delete() call too but with conditions.
    leave child's unconditional Delete() for now.
    
    Change-Id: Ife4e6398b7b0fa69483bc3c795719778c5efcc51
    Reviewed-on: https://gerrit.libreoffice.org/28632
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>
    Tested-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/chart2/source/view/main/ChartItemPool.cxx b/chart2/source/view/main/ChartItemPool.cxx
index 1c55877..7ec565c 100644
--- a/chart2/source/view/main/ChartItemPool.cxx
+++ b/chart2/source/view/main/ChartItemPool.cxx
@@ -42,7 +42,7 @@ ChartItemPool::ChartItemPool():
     /**************************************************************************
     * PoolDefaults
     **************************************************************************/
-    ppPoolDefaults = new SfxPoolItem*[SCHATTR_END - SCHATTR_START + 1];
+    SfxPoolItem** ppPoolDefaults = new SfxPoolItem*[SCHATTR_END - SCHATTR_START + 1];
 
     ppPoolDefaults[SCHATTR_DATADESCR_SHOW_NUMBER    - SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_NUMBER);
     ppPoolDefaults[SCHATTR_DATADESCR_SHOW_PERCENTAGE- SCHATTR_START] = new SfxBoolItem(SCHATTR_DATADESCR_SHOW_PERCENTAGE);
@@ -183,24 +183,17 @@ ChartItemPool::ChartItemPool():
 }
 
 ChartItemPool::ChartItemPool(const ChartItemPool& rPool):
-    SfxItemPool(rPool), ppPoolDefaults(nullptr), pItemInfos(nullptr)
+    SfxItemPool(rPool), pItemInfos(nullptr)
 {
 }
 
 ChartItemPool::~ChartItemPool()
 {
     Delete();
+    // release and delete static pool default items
+    ReleaseDefaults(true);
 
     delete[] pItemInfos;
-
-    const sal_uInt16 nMax = SCHATTR_END - SCHATTR_START + 1;
-    for( sal_uInt16 i=0; i<nMax; ++i )
-    {
-        SetRefCount(*ppPoolDefaults[i], 0);
-        delete ppPoolDefaults[i];
-    }
-
-    delete[] ppPoolDefaults;
 }
 
 SfxItemPool* ChartItemPool::Clone() const
diff --git a/chart2/source/view/main/ChartItemPool.hxx b/chart2/source/view/main/ChartItemPool.hxx
index 5740fcd..dded9d9 100644
--- a/chart2/source/view/main/ChartItemPool.hxx
+++ b/chart2/source/view/main/ChartItemPool.hxx
@@ -27,7 +27,6 @@ namespace chart
 class ChartItemPool : public SfxItemPool
 {
 private:
-    SfxPoolItem**   ppPoolDefaults;
     SfxItemInfo*    pItemInfos;
 
 public:
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 4b3eba9..492d84a 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -352,23 +352,6 @@ SfxItemPool* SdrItemPool::Clone() const
 
 SdrItemPool::~SdrItemPool()
 {
-    // dtor of SfxItemPool
-    Delete();
-
-    // clear own static Defaults
-    if(mppLocalPoolDefaults)
-    {
-        const sal_uInt16 nBeg(SDRATTR_SHADOW_FIRST - SDRATTR_START);
-        const sal_uInt16 nEnd2(SDRATTR_END - SDRATTR_START);
-
-        for(sal_uInt16 i(nBeg); i <= nEnd2; i++)
-        {
-            SetRefCount(*mppLocalPoolDefaults[i],0);
-            delete mppLocalPoolDefaults[i];
-            mppLocalPoolDefaults[i] = nullptr;
-        }
-    }
-
     // split pools before destroying
     SetSecondaryPool(nullptr);
 }
diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx
index fc6a3ff..476e2ab 100644
--- a/svx/source/xoutdev/xpool.cxx
+++ b/svx/source/xoutdev/xpool.cxx
@@ -180,22 +180,8 @@ SfxItemPool* XOutdevItemPool::Clone() const
 XOutdevItemPool::~XOutdevItemPool()
 {
     Delete();
-
-    // remove own static defaults
-    if(mppLocalPoolDefaults)
-    {
-        SfxPoolItem** ppDefaultItem = mppLocalPoolDefaults;
-        for(sal_uInt16 i(GetLastWhich() - GetFirstWhich() + 1); i; --i, ++ppDefaultItem)
-        {
-            if ( *ppDefaultItem ) // these parts might be already cleaned up from a derived class
-            {
-                SetRefCount( **ppDefaultItem, 0 );
-                delete *ppDefaultItem;
-            }
-        }
-
-        delete[] mppLocalPoolDefaults;
-    }
+    // release and delete static pool default items
+    ReleaseDefaults(true);
 
     if(mpLocalItemInfos)
     {


More information about the Libreoffice-commits mailing list