diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-09-22 21:14:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-09-23 06:53:09 +0000 |
commit | b74d2433c856d6d172d9588f4b6d59c31ec02853 (patch) | |
tree | 40f06f2bef1b36a542c7e69184d878bc44a66fe4 | |
parent | 854254c36f4c4804bb5c8fcde2edef444baed25c (diff) |
don't write item right before destruction
SetRefCount writes only SfxPoolItem members m_nRefCount and m_nKind
Change-Id: Ibd06d4edc619b9a840a8a232d9395dd85c452149
Reviewed-on: https://gerrit.libreoffice.org/29195
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sfx2/source/control/itemdel.cxx | 4 | ||||
-rw-r--r-- | svl/source/items/itempool.cxx | 13 | ||||
-rw-r--r-- | svl/source/items/poolio.cxx | 1 |
3 files changed, 4 insertions, 14 deletions
diff --git a/sfx2/source/control/itemdel.cxx b/sfx2/source/control/itemdel.cxx index 096ab3752864..23f900902af9 100644 --- a/sfx2/source/control/itemdel.cxx +++ b/sfx2/source/control/itemdel.cxx @@ -59,10 +59,6 @@ void SfxItemDisruptor_Impl::LaunchDeleteOnIdle() SfxItemDisruptor_Impl::~SfxItemDisruptor_Impl() { m_Idle.Stop(); - - // reset RefCount (was set to SFX_ITEMS_SPECIAL before!) - pItem->SetRefCount( 0 ); - delete pItem; } diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx index 6f4a6f210ad7..eb78949ed0e1 100644 --- a/svl/source/items/itempool.cxx +++ b/svl/source/items/itempool.cxx @@ -334,9 +334,12 @@ void SfxItemPool::ReleaseDefaults for ( sal_uInt16 n = 0; n < nCount; ++n ) { assert(IsStaticDefaultItem(pDefaults[n])); - pDefaults[n]->SetRefCount(0); + if ( bDelete ) { delete pDefaults[n] ; pDefaults[n]= nullptr; } + else + pDefaults[n]->SetRefCount(0); + } if ( bDelete ) @@ -517,9 +520,6 @@ void SfxItemPool::Delete() auto& rItemPtr = pImpl->maPoolDefaults[n]; if (rItemPtr) { -#ifdef DBG_UTIL - SetRefCount(*rItemPtr, 0); -#endif delete rItemPtr; rItemPtr = nullptr; } @@ -549,9 +549,6 @@ void SfxItemPool::Delete() { if (rItemPtr) { -#ifdef DBG_UTIL - SetRefCount(*rItemPtr, 0); -#endif delete rItemPtr; rItemPtr = nullptr; } @@ -571,7 +568,6 @@ void SfxItemPool::SetPoolDefaultItem(const SfxPoolItem &rItem) pNewDefault->SetKind(SfxItemKind::PoolDefault); if (rOldDefault) { - rOldDefault->SetRefCount(0); DELETEZ(rOldDefault); } rOldDefault = pNewDefault; @@ -596,7 +592,6 @@ void SfxItemPool::ResetPoolDefaultItem( sal_uInt16 nWhichId ) pImpl->maPoolDefaults[GetIndex_Impl(nWhichId)]; if (rOldDefault) { - rOldDefault->SetRefCount(0); DELETEZ(rOldDefault); } } diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx index 43e401dcc1ff..0068fcd160f7 100644 --- a/svl/source/items/poolio.cxx +++ b/svl/source/items/poolio.cxx @@ -451,7 +451,6 @@ void SfxItemPool_Impl::readTheItems ( { // Reuse SfxItemPool::AddRef( *pOldItem, rpNewItem->GetRefCount() ); - SfxItemPool::SetRefCount( *rpNewItem, 0 ); delete rpNewItem; rpNewItem = pOldItem; bFound = true; |