summaryrefslogtreecommitdiff
path: root/svl/source/items
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-06-24 13:56:51 +0100
committerMichael Meeks <michael.meeks@collabora.com>2014-06-24 13:57:32 +0100
commit21e977167664e8b5ae86c712b08fde045af7fafd (patch)
tree4e9da0ede8b4cd557a2098cfff8a2c6557c57897 /svl/source/items
parent7637f765cf2f8f65aec5490bd36bf4c745d2cfc6 (diff)
Improve SfxItemPool documentation.
Change-Id: If5a555dae067d023c9dd1fd8e0409ca327739f08
Diffstat (limited to 'svl/source/items')
-rw-r--r--svl/source/items/itempool.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index d18b1226a33e..1990d4639e9f 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -711,6 +711,9 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
SfxPoolItemArrayBase_Impl::iterator ppFree;
bool ppFreeIsSet = false;
+
+ // Is this a 'poolable' item - ie. should we re-use and return
+ // the same underlying item for equivalent (==) SfxPoolItems ?
if ( IsItemFlag_Impl( nIndex, SFX_ITEM_POOLABLE ) )
{
// if is already in a pool, then it is worth checking if it is in this one.
@@ -751,7 +754,7 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
}
else
{
- // look for a freed place
+ // Unconditionally insert; check for a recently freed place
if (pItemArr->maFree.size() > 0)
{
SfxPoolItemArrayBase_Impl::iterator itr = pItemArr->begin();
@@ -765,7 +768,7 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
}
}
- // nicht vorhanden, also im PtrArray eintragen
+ // 3. not found, so clone to insert into the pointer array.
SfxPoolItem* pNewItem = rItem.Clone(pImp->mpMaster);
pNewItem->SetWhich(nWhich);
#ifdef DBG_UTIL
@@ -782,6 +785,7 @@ const SfxPoolItem& SfxItemPool::Put( const SfxPoolItem& rItem, sal_uInt16 nWhich
#endif
AddRef( *pNewItem, pImp->nInitRefCount );
+ // 4. finally insert into the pointer array
assert( pItemArr->maHash.find(pNewItem) == pItemArr->maHash.end() );
if ( !ppFreeIsSet )
{