summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-08-14 21:05:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-08-16 22:20:25 +0200
commit876a433607831f5c82bb952582c151ac653841e7 (patch)
tree08d3516fc3a2a15b38d54637b9b6e261d6139e74 /svx
parent2d7997886b834efe50f16700c8e9f2675a8f223c (diff)
Resolves: tdf#114427 crash when basic used to dispose shape
Change-Id: Ia078a0f4262fbe18b6cf463dbff33df1d4fd0a95 Reviewed-on: https://gerrit.libreoffice.org/59037 Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/unoshape.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 1ea93dde6d34..c1fc65092c6d 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1339,37 +1339,38 @@ void SAL_CALL SvxShape::dispose()
if ( HasSdrObject() )
{
- EndListening( GetSdrObject()->getSdrModelFromSdrObject() );
+ SdrObject* pObject = GetSdrObject();
+
+ EndListening( pObject->getSdrModelFromSdrObject() );
bool bFreeSdrObject = false;
- if ( GetSdrObject()->IsInserted() && GetSdrObject()->GetPage() )
+ if ( pObject->IsInserted() && pObject->GetPage() )
{
OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
// normally, we are allowed to free the SdrObject only if we have its ownership.
// Why isn't this checked here?
- SdrPage* pPage = GetSdrObject()->GetPage();
+ SdrPage* pPage = pObject->GetPage();
// delete the SdrObject from the page
const size_t nCount = pPage->GetObjCount();
for ( size_t nNum = 0; nNum < nCount; ++nNum )
{
- if ( pPage->GetObj( nNum ) == GetSdrObject() )
+ if ( pPage->GetObj( nNum ) == pObject )
{
- OSL_VERIFY( pPage->RemoveObject( nNum ) == GetSdrObject() );
+ OSL_VERIFY( pPage->RemoveObject( nNum ) == pObject );
bFreeSdrObject = true;
break;
}
}
}
- GetSdrObject()->setUnoShape(nullptr);
+ pObject->setUnoShape(nullptr);
if ( bFreeSdrObject )
{
// in case we have the ownership of the SdrObject, a Free
// would do nothing. So ensure the ownership is reset.
mpImpl->mbHasSdrObjectOwnership = false;
- SdrObject* pObject = GetSdrObject();
SdrObject::Free( pObject );
}
}