summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-29 14:27:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-31 07:32:22 +0100
commitc969f04f72b95c5d3a1fdd3cf8190826bab440c2 (patch)
tree71a8e10c56dd7e236631395e341c0e447f19d393 /svl
parent167a2a0a89771f94b9f1124667cfd92459d03869 (diff)
loplugin:useuniqueptr in SfxItemPoolCache::ApplyTo
Change-Id: Ica6ffb5bbaad5c941c65cae02bba7ea2380646f3 Reviewed-on: https://gerrit.libreoffice.org/62652 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/poolcach.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx
index c43d1d50973e..f9e29a7879a5 100644
--- a/svl/source/items/poolcach.cxx
+++ b/svl/source/items/poolcach.cxx
@@ -78,7 +78,7 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem )
}
// Insert the new attributes in a new Set
- SfxSetItem *pNewItem = static_cast<SfxSetItem *>(rOrigItem.Clone());
+ std::unique_ptr<SfxSetItem> pNewItem(static_cast<SfxSetItem *>(rOrigItem.Clone()));
if ( pItemToPut )
{
pNewItem->GetItemSet().PutDirect( *pItemToPut );
@@ -88,8 +88,8 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem )
else
pNewItem->GetItemSet().Put( *pSetToPut );
const SfxSetItem* pNewPoolItem = static_cast<const SfxSetItem*>(&pPool->Put( *pNewItem ));
- DBG_ASSERT( pNewPoolItem != pNewItem, "Pool: same in and out?" );
- delete pNewItem;
+ DBG_ASSERT( pNewPoolItem != pNewItem.get(), "Pool: same in and out?" );
+ pNewItem.reset();
// Adapt refcount; one each for the cache
pNewPoolItem->AddRef( pNewPoolItem != &rOrigItem ? 2 : 1 );