[Libreoffice-commits] core.git: Branch 'libreoffice-6-4-5' - sw/source

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 24 10:24:46 UTC 2020


 sw/source/core/docnode/ndsect.cxx |    5 ++++-
 sw/source/core/edit/eddel.cxx     |   12 +++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 1532a477553ef87dd34693fad50028d6813d5007
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Jun 18 18:32:24 2020 +0200
Commit:     Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Wed Jun 24 12:24:14 2020 +0200

    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 at cib.de>
    (cherry picked from commit 57d488660572d62ef0371e50dcdd4ca7a6d98a14)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96634
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit 1d58ce59eb1ce7c9921a6827077349a9da315f78)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96807
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    Tested-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>

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 162be4b48fff..10e471767998 100644
--- a/sw/source/core/edit/eddel.cxx
+++ b/sw/source/core/edit/eddel.cxx
@@ -101,7 +101,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();
         }


More information about the Libreoffice-commits mailing list