svtools/source/graphic/grfcache.cxx | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-)
New commits: commit f154d00206e55194308a7985348069f0d9058db3 Author: Julien Nabet <serval2...@yahoo.fr> Date: Wed Sep 18 20:17:57 2013 +0200 Fix iterator management Change-Id: I32ac35d3a4d0cc2376c5890086d1ff011442683d Reviewed-on: https://gerrit.libreoffice.org/5998 Reviewed-by: Noel Grandin <noelgran...@gmail.com> Tested-by: Noel Grandin <noelgran...@gmail.com> diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index f91b0fd..966cea8 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -955,30 +955,27 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj ) { bRemoved = (*it)->ReleaseGraphicObjectReference( rObj ); - if( bRemoved ) + if( bRemoved && (0 == (*it)->GetGraphicObjectReferenceCount()) ) { - if( 0 == (*it)->GetGraphicObjectReferenceCount() ) + // if graphic cache entry has no more references, + // the corresponding display cache object can be removed + GraphicDisplayCacheEntryList::iterator it2 = maDisplayCache.begin(); + while( it2 != maDisplayCache.end() ) { - // if graphic cache entry has no more references, - // the corresponding display cache object can be removed - GraphicDisplayCacheEntryList::iterator it2 = maDisplayCache.begin(); - while( it2 != maDisplayCache.end() ) + GraphicDisplayCacheEntry* pDisplayEntry = *it2; + if( pDisplayEntry->GetReferencedCacheEntry() == *it ) { - GraphicDisplayCacheEntry* pDisplayEntry = *it2; - if( pDisplayEntry->GetReferencedCacheEntry() == *it ) - { - mnUsedDisplaySize -= pDisplayEntry->GetCacheSize(); - it2 = maDisplayCache.erase( it2 ); - delete pDisplayEntry; - } - else - ++it2; + mnUsedDisplaySize -= pDisplayEntry->GetCacheSize(); + it2 = maDisplayCache.erase( it2 ); + delete pDisplayEntry; } - - // delete graphic cache entry - delete *it; - it = maGraphicCache.erase( it ); + else + ++it2; } + + // delete graphic cache entry + delete *it; + it = maGraphicCache.erase( it ); } else ++it; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits