diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-09-03 18:45:53 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-05 09:10:33 +0200 |
commit | 8b9e7617e967c4033d9853e6bc2e96334bf6b243 (patch) | |
tree | f9650b48c377b5ba00f0427bf7af3692bc6749f4 | |
parent | dcd08af1808d7984f32d4156c06e4d6c6c25560e (diff) |
tdf#150756 Assertion when opening report for editing
Change-Id: I59cbbc63175a95568f9a0390ab618a5f32d6488b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139331
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svx/unopage.hxx | 2 | ||||
-rw-r--r-- | reportdesign/source/core/sdr/RptModel.cxx | 4 | ||||
-rw-r--r-- | svx/source/unodraw/unopage.cxx | 14 |
3 files changed, 11 insertions, 9 deletions
diff --git a/include/svx/unopage.hxx b/include/svx/unopage.hxx index 0008b5c38ad0..4bc4c1ff7438 100644 --- a/include/svx/unopage.hxx +++ b/include/svx/unopage.hxx @@ -77,7 +77,7 @@ class SVXCORE_DLLPUBLIC SvxDrawPage : protected cppu::BaseMutex, SdrPage* GetSdrPage() const { return mpPage; } // Creation of a SdrObject and insertion into the SdrPage - SdrObject *CreateSdrObject( const css::uno::Reference< css::drawing::XShape >& xShape, bool bBeginning = false ) noexcept; + rtl::Reference<SdrObject> CreateSdrObject( const css::uno::Reference< css::drawing::XShape >& xShape, bool bBeginning = false ) noexcept; // Determine Type and Inventor static void GetTypeAndInventor( SdrObjKind& rType, SdrInventor& rInventor, const OUString& aName ) noexcept; diff --git a/reportdesign/source/core/sdr/RptModel.cxx b/reportdesign/source/core/sdr/RptModel.cxx index e7fa935f8612..90553afec835 100644 --- a/reportdesign/source/core/sdr/RptModel.cxx +++ b/reportdesign/source/core/sdr/RptModel.cxx @@ -59,11 +59,13 @@ OReportModel::~OReportModel() void OReportModel::detachController() { - m_pReportDefinition = nullptr; + if (!m_pReportDefinition) + return; m_pController = nullptr; m_xUndoEnv->EndListening( *this ); ClearUndoBuffer(); m_xUndoEnv->Clear(OXUndoEnvironment::Accessor()); + m_pReportDefinition = nullptr; } rtl::Reference<SdrPage> OReportModel::AllocPage(bool /*bMasterPage*/) diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index c24b51c19690..aad73322adda 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -264,7 +264,7 @@ void SAL_CALL SvxDrawPage::addBottom( const uno::Reference< drawing::XShape >& x return; } - SdrObject *pObj = pShape->GetSdrObject(); + rtl::Reference<SdrObject> pObj = pShape->GetSdrObject(); if(!pObj) { @@ -273,15 +273,15 @@ void SAL_CALL SvxDrawPage::addBottom( const uno::Reference< drawing::XShape >& x } else if ( !pObj->IsInserted() ) { - mpPage->InsertObject( pObj, 0 ); + mpPage->InsertObject( pObj.get(), 0 ); } - pShape->Create( pObj, this ); - OSL_ENSURE( pShape->GetSdrObject() == pObj, "SvxDrawPage::add: shape does not know about its newly created SdrObject!" ); + pShape->Create( pObj.get(), this ); + OSL_ENSURE( pShape->GetSdrObject() == pObj.get(), "SvxDrawPage::add: shape does not know about its newly created SdrObject!" ); if ( !pObj->IsInserted() ) { - mpPage->InsertObject( pObj, 0 ); + mpPage->InsertObject( pObj.get(), 0 ); } mpModel->SetChanged(); @@ -832,7 +832,7 @@ Reference< drawing::XShape > SvxDrawPage::CreateShape( SdrObject *pObj ) const return xShape; } -SdrObject *SvxDrawPage::CreateSdrObject( const Reference< drawing::XShape > & xShape, bool bBeginning ) noexcept +rtl::Reference<SdrObject> SvxDrawPage::CreateSdrObject( const Reference< drawing::XShape > & xShape, bool bBeginning ) noexcept { rtl::Reference<SdrObject> pObj = CreateSdrObject_( xShape ); if( pObj) @@ -846,7 +846,7 @@ SdrObject *SvxDrawPage::CreateSdrObject( const Reference< drawing::XShape > & xS } } - return pObj.get(); + return pObj; } // css::lang::XServiceInfo |