[Libreoffice-commits] core.git: Branch 'feature/SOSAW080' - svx/source
Armin Le Grand
Armin.Le.Grand at cib.de
Mon Apr 2 16:35:34 UTC 2018
svx/source/svdraw/svdobj.cxx | 51 +++++++++++++++++++++++++------------------
1 file changed, 30 insertions(+), 21 deletions(-)
New commits:
commit 2c70acb6353e165bcf2bd3dd8553924307c88427
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Mon Apr 2 12:04:28 2018 +0200
SOSAW080: Reworked SvxShape to use SdrObject's SdrModel
Change-Id: I17bcb44d2e29920c0c74430c2d9c703b36cfa0ad
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 4f480f4046aa..d1dc3a339ac0 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -347,22 +347,7 @@ SdrObject::~SdrObject()
// when they get called from ObjectInDestruction().
mpImpl->maObjectUsers.clear();
- try
- {
- SvxShape* pSvxShape = getSvxShape();
- if ( pSvxShape )
- {
- OSL_ENSURE(!pSvxShape->HasSdrObjectOwnership(),"Please check where this call come from and replace it with SdrObject::Free");
- pSvxShape->InvalidateSdrObject();
- uno::Reference< lang::XComponent > xShapeComp( getWeakUnoShape(), uno::UNO_QUERY_THROW );
- xShapeComp->dispose();
- }
- }
- catch( const uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
+ // UserCall
SendUserCall(SdrUserCallType::Delete, GetLastBoundRect());
o3tl::reset_preserve_ptr_during(pPlusData);
@@ -374,14 +359,38 @@ SdrObject::~SdrObject()
void SdrObject::Free( SdrObject*& _rpObject )
{
SdrObject* pObject = _rpObject; _rpObject = nullptr;
- if ( pObject == nullptr )
+
+ if(nullptr == pObject)
+ {
// nothing to do
return;
+ }
- SvxShape* pShape = pObject->getSvxShape();
- if ( pShape && pShape->HasSdrObjectOwnership() )
- // only the shape is allowed to delete me, and will reset the ownership before doing so
- return;
+ SvxShape* pShape(pObject->getSvxShape());
+
+ if(pShape)
+ {
+ if(pShape->HasSdrObjectOwnership())
+ {
+ // only the SvxShape is allowed to delete me, and will reset
+ // the ownership before doing so
+ return;
+ }
+ else
+ {
+ // not only delete pObject, but also need to dispose uno shape
+ try
+ {
+ pShape->InvalidateSdrObject();
+ uno::Reference< lang::XComponent > xShapeComp( pObject->getWeakUnoShape(), uno::UNO_QUERY_THROW );
+ xShapeComp->dispose();
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
delete pObject;
}
More information about the Libreoffice-commits
mailing list