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@ok.de>
Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
This commit is contained in:
Jochen Nitschke
2016-09-03 16:17:41 +02:00
parent 0c3a9aa403
commit 4d0b71be75
4 changed files with 6 additions and 45 deletions

View File

@@ -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

View File

@@ -27,7 +27,6 @@ namespace chart
class ChartItemPool : public SfxItemPool
{
private:
SfxPoolItem** ppPoolDefaults;
SfxItemInfo* pItemInfos;
public:

View File

@@ -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);
}

View File

@@ -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)
{