Kaydet (Commit) fdbc1246 authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#14552 direct-leak

Change-Id: I8509b5805baca5b6357d7e266c05e3ff4404f4c1
Reviewed-on: https://gerrit.libreoffice.org/71754
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 27434647
......@@ -631,17 +631,15 @@ const SfxPoolItem& SfxItemPool::PutImpl( const SfxPoolItem& rItem, sal_uInt16 nW
}
}
const SfxPoolItem* pFoundItem = nullptr;
// 2. search for an item with matching attributes.
if (rItem.IsSortable())
{
auto pFoundItem = rItemArr.findByLessThan(&rItem);
pFoundItem = rItemArr.findByLessThan(&rItem);
if (pFoundItem)
{
assert(*pFoundItem == rItem);
AddRef(*pFoundItem);
if (bPassingOwnership)
delete &rItem;
return *pFoundItem;
}
}
else
......@@ -650,12 +648,20 @@ const SfxPoolItem& SfxItemPool::PutImpl( const SfxPoolItem& rItem, sal_uInt16 nW
{
if (**itr == rItem)
{
AddRef(**itr);
pFoundItem = *itr;
assert((!bPassingOwnership || (&rItem != *itr)) && "can't be passing ownership and have the item already in the pool");
return **itr;
AddRef(**itr);
break;
}
}
}
if (pFoundItem)
{
if (bPassingOwnership)
delete &rItem;
return *pFoundItem;
}
}
// 3. not found, so clone to insert into the pointer array.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment