[Libreoffice-commits] core.git: svtools/source

Michael Stahl mstahl at redhat.com
Sun Aug 31 05:51:27 PDT 2014


 svtools/source/graphic/grfmgr2.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit ac2ffe70ce5d6ee152876711e8a9d333f86fa1ff
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sun Aug 31 13:18:00 2014 +0200

    GraphicManager: let's assert GraphicObjects are inserted and deleted once
    
    Change-Id: Ie3bfb78434fa25fdbbdfb90cb9590649fec2dc28
    Reviewed-on: https://gerrit.libreoffice.org/11214
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 3db6161..2571036 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -150,6 +150,9 @@ bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Size&
 void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute,
                                       const OString* pID, const GraphicObject* pCopyObj )
 {
+    assert(std::find(maObjList.begin(), maObjList.end(),
+               const_cast<GraphicObject*>(&rObj)) == maObjList.end());
+
     maObjList.push_back( (GraphicObject*)&rObj );
     mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj );
 }
@@ -161,9 +164,10 @@ void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj )
     {
         if ( *it == &rObj ) {
             maObjList.erase( it );
-            break;
+            return;
         }
     }
+    assert(false); // surely it should have been registered?
 }
 
 void GraphicManager::ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj )


More information about the Libreoffice-commits mailing list