diff options
author | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-08-24 20:03:10 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-08-24 21:18:33 -0400 |
commit | 8f931c854038dada37b96db32a0b68ffe52981fa (patch) | |
tree | 4ba2b87ff678a62d0c10a3d20d78c699f2457333 /svtools | |
parent | 792dee46f2b35a21167af182416803c0b80b517c (diff) |
Fixed a crasher in cppunittest in sw, sd and sc on Windows.
Be careful there... when bRemoved is true, the iterator would get
incremented twice which may cause it to go past the end position.
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/graphic/grfcache.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index 55d406389135..66bb2f74b044 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -693,12 +693,9 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj ) { // Release cached object bool bRemoved = false; - - for( - GraphicCacheEntryList::iterator it = maGraphicCache.begin(); - !bRemoved && it != maGraphicCache.end(); - ++it - ) { + GraphicCacheEntryList::iterator it = maGraphicCache.begin(); + while (!bRemoved && it != maGraphicCache.end()) + { bRemoved = (*it)->ReleaseGraphicObjectReference( rObj ); if( bRemoved ) @@ -727,6 +724,8 @@ void GraphicCache::ReleaseGraphicObject( const GraphicObject& rObj ) it = maGraphicCache.erase( it ); } } + else + ++it; } DBG_ASSERT( bRemoved, "GraphicCache::ReleaseGraphicObject(...): GraphicObject not found in cache" ); |