summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2022-03-04 19:18:27 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-08-23 17:34:46 +0200
commitaccd9f68e4058e9771d2332ff8df58622fc80dad (patch)
treead0091dff85511d3edb45ee87f01f680d981985d /sw/qa
parente863d89db03515aaf6fa85f41c534234ab8ad14b (diff)
tdf#140077 sw_redlinehide: fix crash on SplitNode()
The problem is that CutImpl() was called with nLen=0 and so returned without sending any hint to SwTextFrame. Then the MergedPara gets recreated, but the problem is that the SwParaPortion is never invalidated so it still contains the portions of the previous merged paragraph, and painting it will crash. But it turns out that there isn't a hint that would actually work here; instead, generalise a condition in SwTextNode::SplitContentNode() to simply throw away the portions. (regression from commit eb92dc08f2abf5ed088da0d736266f213adf00de) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131039 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit 6518c45dc0c2fb67500af85b97ed40466fd1d1e0) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131026 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit c85863a3b4c632cdf6b6a7448fcf49ffb6bb5f11) Change-Id: I06091ca695ea9180b32e61ddb88ce64fbf20443e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131113 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx
index dc0a1963ff1b..2ac3e7190464 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -1170,6 +1170,44 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571_keep_numbering_with_Reject)
CPPUNIT_ASSERT_MESSAGE("Bad numbering", sNumName.isEmpty());
}
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf140077)
+{
+ SwDoc* const pDoc = createDoc();
+
+ SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+
+ // hide
+ lcl_dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {});
+
+ pWrtShell->Insert("a");
+ pWrtShell->SplitNode();
+ pWrtShell->Insert("b");
+ pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
+ pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false);
+ // enable
+ lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+
+ CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+ pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+ CPPUNIT_ASSERT_MESSAGE(
+ "redlines should be visible",
+ IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags()));
+ CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines());
+
+ pWrtShell->Delete();
+ pWrtShell->SttEndDoc(/*bStart=*/false);
+ pWrtShell->Left(CRSR_SKIP_CHARS, /*bSelect=*/false, 1, /*bBasicCall=*/false);
+ lcl_dispatchCommand(mxComponent, ".uno:TrackChanges", {});
+
+ // crashed in layout
+ pWrtShell->SplitNode();
+
+ pWrtShell->Undo();
+ pWrtShell->Redo();
+ pWrtShell->Undo();
+ pWrtShell->Redo();
+}
+
CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf109376_redline)
{
SwDoc* pDoc = createDoc();