sw/qa/extras/uiwriter/data/tdf147507.fodt | 77 ++++++++++++++++++++++++++++++ sw/qa/extras/uiwriter/uiwriter2.cxx | 19 +++++++ sw/source/core/doc/docredln.cxx | 6 +- 3 files changed, 101 insertions(+), 1 deletion(-)
New commits: commit 8c8ecb1ff2bfe5d40964736ef86ee3054791c493 Author: László Németh <nem...@numbertext.org> AuthorDate: Mon Sep 19 11:24:19 2022 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Sep 19 17:20:49 2022 +0200 tdf#147507 sw: fix crash with Reject All around not content nodes Regression from commit f3bec764ddbf3fd3ae986f034c89626bf22940e0 "tdf144058 sw track changes: fix table deletion at paragraph join". Conflicts: sw/source/core/doc/docredln.cxx (chrery-picked from commit 7462f728df54c28cea659dbf9aa92070019b489f) Change-Id: If08a2b85c3db9fe92ad623d3d7cb30f2feaaab36 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140174 Reviewed-by: László Németh <nem...@numbertext.org> Tested-by: Jenkins diff --git a/sw/qa/extras/uiwriter/data/tdf147507.fodt b/sw/qa/extras/uiwriter/data/tdf147507.fodt new file mode 100644 index 000000000000..bd579a4b85c7 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf147507.fodt @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names: experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:automatic-styles> + <style:style style:name="Table1" style:family="table"> + <style:table-properties style:width="15.621cm" fo:margin-left="-0.191cm" fo:margin-top="0cm" fo:margin-bottom="0cm" table:align="left" style:writing-mode="page"/> + </style:style> + <style:style style:name="Table1.A" style:family="table-column"> + <style:table-column-properties style:column-width="6.765cm"/> + </style:style> + <style:style style:name="Table1.B" style:family="table-column"> + <style:table-column-properties style:column-width="8.856cm"/> + </style:style> + <style:style style:name="Table1.1" style:family="table-row"> + <style:table-row-properties fo:keep-together="auto"/> + </style:style> + <style:style style:name="Table1.A1" style:family="table-cell"> + <style:table-cell-properties fo:padding-left="0.191cm" fo:padding-right="0.191cm" fo:padding-top="0cm" fo:padding-bottom="0cm" fo:border-left="none" fo:border-right="none" fo:border-top="0.5pt solid #000000" fo:border-bottom="0.5pt solid #000000"/> + </style:style> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Block"> + <style:paragraph-properties fo:orphans="0" fo:widows="0"/> + </style:style> + <style:style style:name="P5" style:family="paragraph" style:parent-style-name="Caption" style:master-page-name="Standard"> + <style:paragraph-properties fo:margin-left="1.27cm" fo:margin-right="0cm" fo:text-indent="0cm" style:auto-text-indent="false" style:page-number="1"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.59cm" fo:page-height="27.94cm" style:num-format="i" style:print-orientation="portrait" fo:margin-top="0.847cm" fo:margin-bottom="1.27cm" fo:margin-left="3.81cm" fo:margin-right="2.54cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="36" style:layout-grid-base-height="0.635cm" style:layout-grid-ruby-height="0cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:layout-grid-base-width="0.423cm" style:layout-grid-snap-to="true" style:footnote-max-height="0cm" loext:margin-gutter="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style> + <style:header-footer-properties fo:min-height="1.27cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="1.169cm" style:dynamic-spacing="true"/> + </style:header-style> + <style:footer-style> + <style:header-footer-properties fo:min-height="1.27cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="1.169cm" style:dynamic-spacing="true"/> + </style:footer-style> + </style:page-layout> + <style:style style:name="dp1" style:family="drawing-page"> + <style:drawing-page-properties draw:background-size="full"/> + </style:style> + </office:automatic-styles> + <office:body> + <office:text> + <text:tracked-changes text:track-changes="false"> + <text:changed-region xml:id="ct94794749170512" text:id="ct94794749170512"> + <text:insertion> + <office:change-info> + <dc:creator>Author</dc:creator> + <dc:date>2004-01-12T03:00:00</dc:date> + </office:change-info> + </text:insertion> + </text:changed-region> + <text:changed-region xml:id="ct94794748244288" text:id="ct94794748244288"> + <text:deletion> + <office:change-info> + <dc:creator>Author</dc:creator> + <dc:date>2004-01-05T21:45:00</dc:date> + </office:change-info> + </text:deletion> + </text:changed-region> + </text:tracked-changes> + <text:p text:style-name="P5"><text:change-start text:change-id="ct94794749170512"/>a<text:change-end text:change-id="ct94794749170512"/></text:p> + <text:p text:style-name="Contents_20_1"/> + <table:table table:name="Table1" table:style-name="Table1"> + <table:table-column table:style-name="Table1.A"/> + <table:table-column table:style-name="Table1.B"/> + <table:table-row table:style-name="Table1.1"> + <table:table-cell table:style-name="Table1.A1" office:value-type="string"> + <text:p text:style-name="P1"/> + </table:table-cell> + <table:table-cell table:style-name="Table1.A1" office:value-type="string"> + <text:p text:style-name="P1"/> + </table:table-cell> + </table:table-row> + </table:table> + <text:p text:style-name="Caption"><text:change-start text:change-id="ct94794748244288"/>s<text:change-end text:change-id="ct94794748244288"/></text:p> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 38247a36ea4d..0a5fce248c58 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -2036,6 +2036,25 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf144058) CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xTables->getCount()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf147507) +{ + SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf147507.fodt"); + + // turn on red-lining and show changes + pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On | RedlineFlags::ShowDelete + | RedlineFlags::ShowInsert); + CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + CPPUNIT_ASSERT_MESSAGE( + "redlines should be visible", + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + + // select all, backspace and reject all crashed + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:SwBackSpace", {}); + dispatchCommand(mxComponent, ".uno:RejectAllTrackedChanges", {}); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119019) { // check handling of overlapping redlines diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index ec164f5d0bb8..9a7e66051bde 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -924,7 +924,11 @@ void SwRedlineExtraData_FormatColl::Reject( SwPaM& rPam ) const { aPam.GetPoint()->nNode--; SwContentNode* pNode = aPam.GetPoint()->nNode.GetNode().GetContentNode(); - aPam.GetPoint()->nContent.Assign( pNode, pNode->Len() ); + if ( pNode ) + aPam.GetPoint()->nContent.Assign( pNode, pNode->Len() ); + else + // tdf#147507 set it back to a content node to avoid of crashing + aPam.GetPoint()->nNode++; } else if (aPam.GetPoint()->nNode < aPam.GetMark()->nNode) {