summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-06-18 18:32:24 +0200
committerAndras Timar <andras.timar@collabora.com>2020-06-22 08:52:12 +0200
commit7631cf3837fa5c7327d9017ee2ed7638b449e4a7 (patch)
tree500850cfcec538b16de86865f5b0fc24fed82b09 /sw
parentfb235b60aa440c0d7a952caf505478516f939212 (diff)
tdf#133990 sw_redlinehide: fix Undo with section before table
... at start of document. The section node wasn't included in the PaM passed to SwUndoDelete, so on Undo it called MakeFrames() starting from the contained table node and crashed when reaching the section's end node. Fixed, then it crashes in Redo, because SwDoc::DelSectionFormat() calls SetModified() which calls some event listener which causes EndAllAction() to be called, which by itself is scary and then it crashes because the nodes array contains a bunch of deleted nodes. Not sure if that SetModified() serves any purpose, but it's pointless in Undo. (1st crash is regression from 68880a3004623553bf1920ad8a4a4d2be4bca234) Change-Id: Iafdd073ca9577bf54dd5a8ad2eb8f8f110db93b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96620 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de> (cherry picked from commit 57d488660572d62ef0371e50dcdd4ca7a6d98a14) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96634 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/docnode/ndsect.cxx5
-rw-r--r--sw/source/core/edit/eddel.cxx12
2 files changed, 15 insertions, 2 deletions
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 8655874fe858..ef388242fa67 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -598,7 +598,10 @@ void SwDoc::DelSectionFormat( SwSectionFormat *pFormat, bool bDelNodes )
GetIDocumentUndoRedo().EndUndo(SwUndoId::DELSECTION, nullptr);
- getIDocumentState().SetModified();
+ if (GetIDocumentUndoRedo().DoesUndo())
+ { // TODO is this ever needed?
+ getIDocumentState().SetModified();
+ }
}
void SwDoc::UpdateSection( size_t const nPos, SwSectionData & rNewData,
diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx
index 2951b56b4cd5..74e845353566 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -106,7 +106,17 @@ void SwEditShell::DeleteSel( SwPaM& rPam, bool* pUndo )
pNewPam.reset(new SwPaM(*rPam.GetMark(), *rPam.GetPoint()));
// Selection starts at the first para of the first cell, but we
// want to delete the table node before the first cell as well.
- pNewPam->Start()->nNode = pNewPam->Start()->nNode.GetNode().FindTableNode()->GetIndex();
+ while (SwTableNode const* pTableNode =
+ pNewPam->Start()->nNode.GetNode().StartOfSectionNode()->FindTableNode())
+ {
+ pNewPam->Start()->nNode = *pTableNode;
+ }
+ // tdf#133990 ensure section is included in SwUndoDelete
+ while (SwSectionNode const* pSectionNode =
+ pNewPam->Start()->nNode.GetNode().StartOfSectionNode()->FindSectionNode())
+ {
+ pNewPam->Start()->nNode = *pSectionNode;
+ }
pNewPam->Start()->nContent.Assign(nullptr, 0);
pPam = pNewPam.get();
}