diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2013-09-18 20:17:57 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2013-10-01 08:12:45 +0000 |
commit | f154d00206e55194308a7985348069f0d9058db3 (patch) | |
tree | 779e6e52a1c0f7806daa9c7def4bf33e5fecad6e /svtools | |
parent | 9f4c18e64c1e552a57126975b88a7fbf2b092d3f (diff) |
Fix iterator management
Change-Id: I32ac35d3a4d0cc2376c5890086d1ff011442683d
Reviewed-on: https://gerrit.libreoffice.org/5998
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/graphic/grfcache.cxx | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index f91b0fd09979..966cea87b75f 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; |