diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-11-17 12:51:32 +0000 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-12-01 10:12:55 +0100 |
commit | 138cf950dcdc8a1240452cad6867e197279f42b0 (patch) | |
tree | 97a87d3ac142c72428a785fa086a549279f65e2f /external | |
parent | b18c7096af799e49bc27771cd1500c4eff6bb780 (diff) |
tdf#134626 assertion in ~SwTextNode
taking the simplest example of...
http://bugs.documentfoundation.org/attachment.cgi?id=167361
a) on ctrl+v paste into the new document:
DocumentContentOperationsManager::CopyImplImpl
is called and that (at "Also copy all format templates")
causes SwTextNode::ChgTextCollUpdateNum
to call rDoc.GetNodes().UpdateOutlineNode(*this)
so the new paragraph is now set as an outline node of the
document DocNodes
that seems perfectly reasonable
b) ctrl+v again
no new paragraph, text appended to node of a)
c) ctrl+z
SwUndoSaveContent::MoveToUndoNds is called
and rNodes.MakeTextNode is called to make a
new TextNode to move the content into.
The SwNodes the TextNode is created in are rNds =
rDoc.GetUndoManager().GetUndoNodes(), i.e. the undo nodes.
MakeTextNode calls...
SwTextNode *pNode = new SwTextNode( rWhere, pColl, nullptr )
and the SwTextNode ctor unconditionally does...
GetNodes().UpdateOutlineNode(*this);
so its set as an outline node in those undo SwNodes
In SwNodes::MakeTextNode right after the
SwTextNode *pNode = new SwTextNode( rWhere, pColl, nullptr )
call we have...
// call method <UpdateOutlineNode(..)> only for the document nodes array
if ( IsDocNodes() )
UpdateOutlineNode(*pNode);
That seems odd, because we have *already* unconditionally called
UpdateOutlineNode in the SwTextNode ctor.
d) ctrl+z
The SwTextFormatColl is destroyed
and SwTextNode::TriggerNodeUpdate
is called for the TextNode of a) and is updated. It is also
called for the TextNode of c) but due to...
// #125329# - assure that text node is in document nodes array
if ( !rDoc.IsInDtor() && &rDoc.GetNodes() == &GetNodes() )
c is *not* updated, so on eventual dtor of c the assert fires.
Change-Id: I56f9b00dd4665fd44359a01baef66c82937c2781
---
If the conditional UpdateOutlineNode call in SwNodes::MakeTextNode is
the right thing to do where only TextNodes in the DocNodes should be
updated, then presumably the equivalent call in the SwTextNode
ctor should be also conditional, making that MakeTextNode call redundant
in any case.
ChgTextCollUpdateNum always calls
rDoc.GetNodes().UpdateOutlineNode(*this);
which suggests that the SwTextNode::ChgFormatColl function should
rely on that to call UpdateOutlineNode and not call it directly
to also avoid a UpdateOutlineNode in the undo nodes
Change-Id: Iedc3fb4d41c24dbbe41fbac259abe41d3757be09
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106011
Tested-by: Jenkins
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'external')
0 files changed, 0 insertions, 0 deletions