[Libreoffice-commits] .: svtools/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Aug 24 18:18:33 PDT 2011


 svtools/source/graphic/grfcache.cxx |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

New commits:
commit 8f931c854038dada37b96db32a0b68ffe52981fa
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Aug 24 20:03:10 2011 -0400

    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.

diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx
index 55d4063..66bb2f7 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" );


More information about the Libreoffice-commits mailing list