[Libreoffice-commits] core.git: sw/source
Michael Stahl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 18 16:10:35 UTC 2020
sw/source/core/undo/undel.cxx | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
New commits:
commit 5d836621326c68decaae09f1911d2d036a251b43
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Thu Jun 18 14:19:12 2020 +0200
Commit: Michael Stahl <michael.stahl at cib.de>
CommitDate: Thu Jun 18 18:09:58 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>
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 739597cf6fce..d225d1eb2868 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -856,6 +856,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,
@@ -1042,8 +1043,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);
@@ -1135,6 +1139,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