svl/source/items/itempool.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit 21e977167664e8b5ae86c712b08fde045af7fafd
Author: Michael Meeks <michael.me...@collabora.com>
Date:   Tue Jun 24 13:56:51 2014 +0100

    Improve SfxItemPool documentation.
    
    Change-Id: If5a555dae067d023c9dd1fd8e0409ca327739f08

diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index d18b122..1990d46 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 )
     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to