[Libreoffice-commits] core.git: sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 1 06:16:23 UTC 2020
sw/source/core/draw/dcontact.cxx | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit a609bc9cc03a0a23c8f20fee808cc6cc2887170d
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Mon Aug 31 15:24:48 2020 +0200
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Tue Sep 1 08:15:43 2020 +0200
tdf#135661 sw: fix Undo of text deletion of SdrObject
This creates a non-working SwXShape without m_pFormat initialised:
0 SwXShape::SwXShape(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>&, SwDoc const*) (this=0x278de80, xShape=uno::Reference to (SvxCustomShape *) 0x73ec840, pDoc=0x0) at sw/source/core/unocore/unodraw.cxx:889
1 SwFmDrawPage::CreateShape(SdrObject*) const (this=0x637a980, pObj=0x6409410) at sw/source/core/unocore/unodraw.cxx:372
2 SdrObject::getUnoShape() (this=0x6409410) at svx/source/svdraw/svdobj.cxx:2836
3 GetXShapeForSdrObject(SdrObject*) (pObj=0x6409410) at svx/source/unodraw/unoshape.cxx:3928
4 SdrObjCustomShape::GetCustomShapeEngine() const (this=0x6409410) at svx/source/svdraw/svdoashp.cxx:381
5 SdrObjCustomShape::GetTextBounds(tools::Rectangle&) const (this=0x6409410, rTextBound=...) at svx/source/svdraw/svdoashp.cxx:534
6 SdrObjCustomShape::AdaptTextMinSize() (this=0x6409410) at svx/source/svdraw/svdoashp.cxx:1397
7 SdrObjCustomShape::NbcSetSnapRect(tools::Rectangle const&) (this=0x6409410, rRect=...) at svx/source/svdraw/svdoashp.cxx:1421
8 SdrObjCustomShape::handlePageChange(SdrPage*, SdrPage*) (this=0x6409410, pOldPage=0x0, pNewPage=0x627fc80) at svx/source/svdraw/svdoashp.cxx:2855
9 SdrObject::setParentOfSdrObject(SdrObjList*) (this=0x6409410, pNewObjList=0x627fc80) at svx/source/svdraw/svdobj.cxx:294
10 SetParentAtSdrObjectFromSdrObjList(SdrObject&, SdrObjList*) (rSdrObject=..., pNew=0x627fc80) at svx/source/svdraw/svdpage.cxx:65
11 SdrObjList::NbcInsertObject(SdrObject*, unsigned long) (this=0x627fc80, pObj=0x6409410, nPos=0) at svx/source/svdraw/svdpage.cxx:305
12 SdrObjList::InsertObject(SdrObject*, unsigned long) (this=0x627fc80, pObj=0x6409410, nPos=0) at svx/source/svdraw/svdpage.cxx:358
13 FmFormPage::InsertObject(SdrObject*, unsigned long) (this=0x627fc80, pObj=0x6409410, nPos=0) at svx/source/form/fmpage.cxx:79
14 SwDrawContact::InsertMasterIntoDrawPage() (this=0x640d6b0) at sw/source/core/draw/dcontact.cxx:1909
15 SwDrawContact::SwClientNotify(SwModify const&, SfxHint const&) (this=0x640d6b0, rMod=..., rHint=...) at sw/source/core/draw/dcontact.cxx:1457
16 SwModify::CallSwClientNotify(SfxHint const&) const (this=0x640d090, rHint=...) at sw/source/core/attr/calbck.cxx:373
17 sw::BroadcastingModify::CallSwClientNotify(SfxHint const&) const (this=0x640d090, rHint=...) at sw/source/core/attr/calbck.cxx:378
18 SwUndoFlyBase::InsFly(sw::UndoRedoContext&, bool) (this=0x78cdfd0, rContext=..., bShowSelFrame=false) at sw/source/core/undo/undobj1.cxx:97
19 SwUndoDelLayFormat::UndoImpl(sw::UndoRedoContext&) (this=0x78cdfd0, rContext=...) at sw/source/core/undo/undobj1.cxx:440
20 SwHistoryTextFlyCnt::SetInDoc(SwDoc*, bool) (this=0x60d14c0, pDoc=0x625aa30) at sw/source/core/undo/rolbck.cxx:581
Whereas if the shape is selected and deleted that way, a completely
different Undo is created, which doesn't have this problem:
0 SwXShape::SetFrameFormat(SwFrameFormat*) (this=0x2497d50, pFormat=0x564b470) at sw/inc/unodraw.hxx:206
1 SwXShape::AddExistingShapeToFormat(SdrObject const&) (_rObj=...) at sw/source/core/unocore/unodraw.cxx:945
2 SwDrawContact::SwDrawContact(SwFrameFormat*, SdrObject*) (this=0x6bad330, pToRegisterIn=0x564b470, pObj=0x5647880) at sw/source/core/draw/dcontact.cxx:709
3 SwUndoDrawDelete::UndoImpl(sw::UndoRedoContext&) (this=0x56ebcd0, rContext=...) at sw/source/core/undo/undraw.cxx:501
In SwUndoDelLayFormat, the SdrObject is apparently removed from SdrPage
and the SwDrawContact remains, whereas in SwUndoDrawDelete, the
SdrObject remains on SdrPage but is moved to invisible layer, and
SwDrawContact is destroyed (presumably).
Include obligatory rant why sw has 2 undos doing the same thing here.
(reportedly regression from 2d89b9929e85bede4c72684a12e7508751875f0e
but probably this can be triggered before, at least since
91b2325808a75174f284c48c8b8afc118fad74e4)
Change-Id: I4fbb3620bfe1ac07f47e4441625797db7a87cecd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101740
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl at cib.de>
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 0b6fffab9057..74cff2fd43bc 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1458,6 +1458,9 @@ void SwDrawContact::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
// #i40845# - follow-up of #i35635#
// move object to visible layer
MoveObjToVisibleLayer(GetMaster());
+ // tdf#135661 InsertMasterIntoDrawPage may have created a new
+ // SwXShape with null m_pFormat; fix that
+ SwXShape::AddExistingShapeToFormat(*GetMaster());
break;
case sw::DrawFrameFormatHintId::PREP_DELETE_FLY:
RemoveMasterFromDrawPage();
More information about the Libreoffice-commits
mailing list