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

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 19 23:24:18 UTC 2020


 sw/source/core/undo/undel.cxx |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 139bf8208a7f59b742afac0eefb60e2e73316145
Author:     Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Jun 18 14:19:12 2020 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sat Jun 20 01:23:46 2020 +0200

    tdf#134021 sw_redlinehide: fix crash if document contains only table
    
    This sets the m_bTableDelLastNd flag in SwUndoDelete, so a SwTextNode is
    created so that there's something in the document, and there are 2
    problems with Undo:
    
    1. ~SwIndexReg assert because there's a shell cursor on the text node;
       could fix this with some PaMCorrAbs() but let's just call
       DelFullPara() which takes care of that.
       (this likely isn't possible in the !m_bTableDelLastNd case)
    
    2. no frames are created in MakeFrames() because there's no node in the
       document with layout frames, so delete it at the end.
       (regression from 723728cd358693b8f4bc9d913541aa4479f2bd48)
    
    Change-Id: I6d8535ae1a2e607d665660f149b344e817bc8ab0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96604
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>
    (cherry picked from commit 5d836621326c68decaae09f1911d2d036a251b43)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96632
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 0510ea64dc37..504bfee25164 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -860,6 +860,7 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
         SwPosition aPos( aIdx );
         if( !m_bDelFullPara )
         {
+            assert(!m_bTableDelLastNd || pInsNd->IsTextNode());
             if( pInsNd->IsTableNode() )
             {
                 pInsNd = rDoc.GetNodes().MakeTextNode( aIdx,
@@ -1046,8 +1047,11 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
         }
     }
     // delete the temporarily added Node
-    if( pInsNd )
+    if (pInsNd && !m_bTableDelLastNd)
+    {
+        assert(&aIdx.GetNode() == pInsNd);
         rDoc.GetNodes().Delete( aIdx );
+    }
     if( m_pRedlSaveData )
         SetSaveData(rDoc, *m_pRedlSaveData);
 
@@ -1139,6 +1143,15 @@ void SwUndoDelete::UndoImpl(::sw::UndoRedoContext & rContext)
         lcl_MakeAutoFrames(*rDoc.GetSpzFrameFormats(), pMovedNode->GetIndex());
     }
 
+    // tdf#134021 only after MakeFrames(), because it may be the only node
+    // that has layout frames
+    if (pInsNd && m_bTableDelLastNd)
+    {
+        assert(&aIdx.GetNode() == pInsNd);
+        SwPaM tmp(aIdx, aIdx);
+        rDoc.getIDocumentContentOperations().DelFullPara(tmp);
+    }
+
     AddUndoRedoPaM(rContext, true);
 }
 


More information about the Libreoffice-commits mailing list