diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-27 10:27:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-08-29 13:44:02 +0200 |
commit | 8611f6e259b807b4f19c8dc0eab86ca648891ce3 (patch) | |
tree | fa2b0e463aafb51df754768f916ca9104969a557 /svx/source/engine3d/extrud3d.cxx | |
parent | 25a997c15d39fb30676a375df8ea4ce1ed2e1acd (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 'svx/source/engine3d/extrud3d.cxx')
-rw-r--r-- | svx/source/engine3d/extrud3d.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx index fadb645d3292..c268bec20baa 100644 --- a/svx/source/engine3d/extrud3d.cxx +++ b/svx/source/engine3d/extrud3d.cxx @@ -112,7 +112,7 @@ SdrObjKind E3dExtrudeObj::GetObjIdentifier() const return SdrObjKind::E3D_Extrusion; } -E3dExtrudeObj* E3dExtrudeObj::CloneSdrObject(SdrModel& rTargetModel) const +rtl::Reference<SdrObject> E3dExtrudeObj::CloneSdrObject(SdrModel& rTargetModel) const { return new E3dExtrudeObj(rTargetModel, *this); } @@ -154,7 +154,7 @@ bool E3dExtrudeObj::IsBreakObjPossible() return true; } -std::unique_ptr<SdrAttrObj,SdrObjectFreeOp> E3dExtrudeObj::GetBreakObj() +rtl::Reference<SdrAttrObj> E3dExtrudeObj::GetBreakObj() { basegfx::B3DPolyPolygon aFrontSide; basegfx::B3DPolyPolygon aBackSide; @@ -205,13 +205,13 @@ std::unique_ptr<SdrAttrObj,SdrObjectFreeOp> E3dExtrudeObj::GetBreakObj() { // create PathObj basegfx::B2DPolyPolygon aPoly = TransformToScreenCoor(aBackSide); - std::unique_ptr<SdrPathObj,SdrObjectFreeOp> pPathObj(new SdrPathObj(getSdrModelFromSdrObject(), SdrObjKind::PolyLine, std::move(aPoly))); + rtl::Reference<SdrPathObj> pPathObj(new SdrPathObj(getSdrModelFromSdrObject(), SdrObjKind::PolyLine, std::move(aPoly))); SfxItemSet aSet(GetObjectItemSet()); aSet.Put(XLineStyleItem(css::drawing::LineStyle_SOLID)); pPathObj->SetMergedItemSet(aSet); - return std::unique_ptr<SdrAttrObj,SdrObjectFreeOp>(pPathObj.release()); + return pPathObj; } return nullptr; |