summaryrefslogtreecommitdiff
path: root/basctl/source/dlged/dlgedobj.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-27 10:27:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-29 13:44:02 +0200
commit8611f6e259b807b4f19c8dc0eab86ca648891ce3 (patch)
treefa2b0e463aafb51df754768f916ca9104969a557 /basctl/source/dlged/dlgedobj.cxx
parent25a997c15d39fb30676a375df8ea4ce1ed2e1acd (diff)
ref-count SdrObject
Which means we can get rid of the majestic hack of ScCaptionPtr Previously, SdrObject was manually managed, and the ownership passed around in very complicated fashion. Notes: (*) SvxShape has a strong reference to SdrObject, where previously it had a weak reference. It is now strong since otherwise the SdrObject will go away very eagerly. (*) SdrObject still has a weak reference to SvxShape (*) In the existing places that an SdrObject is being deleted, we now just clear the reference (*) instead of SwVirtFlyDrawObj removing itself from the page that contains inside it's destructor, make the call site do the removing from the page. (*) Needed to take the SolarMutex in UndoManagerHelper_Impl::impl_clear because this can be called from UNO (e.g. sfx2_complex JUnit test) and the SdrObjects need the SolarMutex when destructing. (*) handle a tricky situation with SwDrawVirtObj in the SwDrawModel destructor because the existing code wants mpDrawObj in SwAnchoredObject to be sometimes owning, sometimes not, which results in a cycle with the new code. Change-Id: I4d79df1660e386388e5d51030653755bca02a163 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138837 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basctl/source/dlged/dlgedobj.cxx')
-rw-r--r--basctl/source/dlged/dlgedobj.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 1d89210b7dd5..3e06307941da 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -70,7 +70,6 @@ DlgEditor& DlgEdObj::GetDialogEditor ()
DlgEdObj::DlgEdObj(SdrModel& rSdrModel)
: SdrUnoObj(rSdrModel, OUString())
,bIsListening(false)
- ,pDlgEdForm( nullptr )
{
}
@@ -118,7 +117,6 @@ DlgEdObj::DlgEdObj(
const css::uno::Reference< css::lang::XMultiServiceFactory >& rxSFac)
: SdrUnoObj(rSdrModel, rModelName, rxSFac)
,bIsListening(false)
- ,pDlgEdForm( nullptr )
{
}
@@ -906,16 +904,16 @@ SdrObjKind DlgEdObj::GetObjIdentifier() const
}
}
-DlgEdObj* DlgEdObj::CloneSdrObject(SdrModel& rTargetModel) const
+rtl::Reference<SdrObject> DlgEdObj::CloneSdrObject(SdrModel& rTargetModel) const
{
return new DlgEdObj(rTargetModel, *this);
}
-SdrObjectUniquePtr DlgEdObj::getFullDragClone() const
+rtl::Reference<SdrObject> DlgEdObj::getFullDragClone() const
{
// no need to really add the clone for dragging, it's a temporary
// object
- return SdrObjectUniquePtr(new SdrUnoObj(getSdrModelFromSdrObject(), *this));
+ return rtl::Reference<SdrObject>(new SdrUnoObj(getSdrModelFromSdrObject(), *this));
}
void DlgEdObj::NbcMove( const Size& rSize )
@@ -961,7 +959,7 @@ bool DlgEdObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
// implementation. For historical reasons, the SdrPage (which is the DlgEdPage) was
// already set. For now, get it from the SdrDragStat and use it to access and set
// the local pDlgEdForm
- if(nullptr == pDlgEdForm && nullptr != rStat.GetPageView())
+ if(!pDlgEdForm && nullptr != rStat.GetPageView())
{
const DlgEdPage* pDlgEdPage(dynamic_cast<const DlgEdPage*>(rStat.GetPageView()->GetPage()));