diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-03-04 19:18:27 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-03-09 09:17:24 +0100 |
commit | 6106fbf376fc7583acd8658cedd49d54a1b1f0a4 (patch) | |
tree | 00999139aa4f340cbf0f9948aa01e753023a3ccc /sw/qa/extras/uiwriter | |
parent | 4139dbe9243d50b60595205354eb799af68192c7 (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)
Change-Id: I06091ca695ea9180b32e61ddb88ce64fbf20443e
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/+/131025
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras/uiwriter')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 988225938a89..4e9080bdc951 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -1409,6 +1409,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 = createSwDoc(); + + SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + + // hide + 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 + 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); + 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 = createSwDoc(); |