summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-08-14 16:35:32 +0200
committerAndras Timar <andras.timar@collabora.com>2020-08-23 19:15:59 +0200
commit5563f6ba24a7d96062ab8f1a6f3234a39e999bc2 (patch)
tree11c4d6a946da0fc2420e78608c801a052288f1a4 /sw
parent202099e967c2a46c01b5d3ec5a041972610292bf (diff)
tdf#135457 sw: fix invalidation of SwXTextField
This was supposed to happen from SwNodes::ChgNode() when moving to the undo nodes array. There are fields with a range that contains other fields, when the outer field's range is deleted, the contained field moves to the undo array and its position is no longer valid to be given out by SwXTextField::getAnchor(). (regression from c73b5e969b2f9abdb2b9191938ca30bec5af725d ERR no, actually more likely from e18359445fabad9ba1a704600e9ee327112cc6ae) Change-Id: I38c8b3393a777ca8dc8739b5ca4233a7f124961e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100749 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 14fd4b54113f884cfd6871aeff693734fc06224b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100705 Reviewed-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 27e9ead64d4e3a3f3b3d1203f7b9fee50eb0d04d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100987 Tested-by: Michael Stahl <michael.stahl@cib.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101233 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/txtnode/atrfld.cxx2
-rw-r--r--sw/source/core/undo/undobj.cxx4
2 files changed, 5 insertions, 1 deletions
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index fba15a6107f9..ebcdced03c52 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -217,7 +217,7 @@ void SwFormatField::InvalidateField()
{
SwPtrMsgPoolItem const item(RES_REMOVE_UNO_OBJECT,
&static_cast<SwModify&>(*this)); // cast to base class (void*)
- NotifyClients(&item, &item);
+ CallSwClientNotify(sw::LegacyModifyHint{ &item, &item });
}
void SwFormatField::SwClientNotify( const SwModify& rModify, const SfxHint& rHint )
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index bfea81a886b6..fa86072a3008 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -849,6 +849,10 @@ void SwUndoSaveContent::DelContentIndex( const SwPosition& rMark,
SwDoc* pDoc = rMark.nNode.GetNode().GetDoc();
+ // if it's not in the doc array, probably missing some invalidation somewhere
+ assert(&rPoint.nNode.GetNodes() == &pDoc->GetNodes());
+ assert(&rMark.nNode.GetNodes() == &pDoc->GetNodes());
+
::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
// 1. Footnotes