summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <Michael.Stahl@cib.de>2020-06-18 14:19:12 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-06-18 18:09:58 +0200
commit5d836621326c68decaae09f1911d2d036a251b43 (patch)
tree904d5f4c633a3c531256c48d00a4a4d515938d73
parent21a59b59d9a40ca32d91b05e62ffcd9aef8fd324 (diff)
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@cib.de>
-rw-r--r--sw/source/core/undo/undel.cxx15
1 files changed, 14 insertions, 1 deletions
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);
}