Kaydet (Commit) ac2ffe70 authored tarafından Michael Stahl's avatar Michael Stahl

GraphicManager: let's assert GraphicObjects are inserted and deleted once

Change-Id: Ie3bfb78434fa25fdbbdfb90cb9590649fec2dc28
Reviewed-on: https://gerrit.libreoffice.org/11214Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 9fcf955c
...@@ -150,6 +150,9 @@ bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Size& ...@@ -150,6 +150,9 @@ bool GraphicManager::DrawObj( OutputDevice* pOut, const Point& rPt, const Size&
void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute, void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubstitute,
const OString* pID, const GraphicObject* pCopyObj ) const OString* pID, const GraphicObject* pCopyObj )
{ {
assert(std::find(maObjList.begin(), maObjList.end(),
const_cast<GraphicObject*>(&rObj)) == maObjList.end());
maObjList.push_back( (GraphicObject*)&rObj ); maObjList.push_back( (GraphicObject*)&rObj );
mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj ); mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj );
} }
...@@ -161,9 +164,10 @@ void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj ) ...@@ -161,9 +164,10 @@ void GraphicManager::ImplUnregisterObj( const GraphicObject& rObj )
{ {
if ( *it == &rObj ) { if ( *it == &rObj ) {
maObjList.erase( it ); maObjList.erase( it );
break; return;
} }
} }
assert(false); // surely it should have been registered?
} }
void GraphicManager::ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj ) void GraphicManager::ImplGraphicObjectWasSwappedOut( const GraphicObject& rObj )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment