summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-08-31 13:18:00 +0200
committerMichael Stahl <mstahl@redhat.com>2014-08-31 07:50:59 -0500
commitac2ffe70ce5d6ee152876711e8a9d333f86fa1ff (patch)
tree47698351b3173acdbac52801df2bb5ac6cc393f2 /svtools
parent9fcf955c339149f2ecb215cdd4eaa5a81b2963d1 (diff)
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@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/graphic/grfmgr2.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 3db61617799a..25710360ce22 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 )