Skip to content

Commit 41f64cc

Browse files
caolanmx1sc0
authored andcommitted
crashtesting: don't create a redundant SwRedlineItr for a merged paragraph
CtorInitAttrIter can build a SwRedlineItr for a merged paragraph in Mode::Ignore but have no extended-input array. That combination has nothing useful to do, and the ctor asserts. An issue probably since: commit 4fccc66 Date: Tue Nov 3 16:40:45 2020 +0100 sw_fieldmarkhide: SwRedlineItr assumption that Show means no MergedPara Reproduced on saving ooo121134-1.docx (and ooo121176-1.docx) to odt. The docx loads fine, but asserts on export to odt when exporting a text frame forces an on-demand layout. Skip it, a null m_pRedline is already handled throughout SwAttrIter. soffice.bin: sw/source/core/text/redlnitr.cxx:858: SwRedlineItr::SwRedlineItr(...): Assertion `m_pExt || m_eMode != Mode::Ignore' failed. #4 SwRedlineItr::SwRedlineItr at sw/source/core/text/redlnitr.cxx:858 #5 SwAttrIter::CtorInitAttrIter at sw/source/core/text/redlnitr.cxx:817 #10 SwTextFormatter::CtorInitTextFormatter at sw/source/core/text/itrform2.cxx:97 #12 SwTextFrame::FormatImpl at sw/source/core/text/frmform.cxx:2092 #14 SwContentFrame::MakeAll at sw/source/core/layout/calcmove.cxx:1633 #20 SwLayAction::Action at sw/source/core/layout/layact.cxx:404 #21 SwViewShell::CalcLayout at sw/source/core/view/viewsh.cxx:1313 #22 SwEditShell::CalcLayout at sw/source/core/edit/edws.cxx:89 #23 SwXFrame::getPropertyValue at sw/source/core/unocore/unoframe.cxx:2216 #25 XMLTextParagraphExport::addTextFrameAttributes at xmloff/source/text/txtparae.cxx:2968 #32 XMLTextParagraphExport::exportText at xmloff/source/text/txtparae.cxx:1746 #34 SwXMLExport::ExportContent_ at sw/source/filter/xml/xmlexp.cxx:552 #36 SvXMLExport::exportDoc at xmloff/source/core/xmlexp.cxx:1440 #44 SwXMLWriter::Write at sw/source/filter/xml/wrtxml.cxx:479 #46 SwDocShell::SaveAs at sw/source/uibase/app/docsh.cxx:544 #53 SfxBaseModel::storeToURL at sfx2/source/doc/sfxbasemodel.cxx:1829 #54 desktop::DispatchWatcher::executeDispatchRequests at desktop/source/app/dispatchwatcher.cxx:714 Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com> Change-Id: Ia290785e8a60c5b8b972e51d490b0cdf0b730111 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4726 Tested-by: Jenkins CPCI <releng@collaboraoffice.com> Reviewed-by: Michael Stahl <michael.stahl@collabora.com> (cherry picked from commit 602a72c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207159 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
1 parent 8f8d739 commit 41f64cc

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎sw/source/core/text/redlnitr.cxx‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -808,13 +808,18 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode,
808808
Seek( TextFrameIndex(0) );
809809
}
810810

811+
SwRedlineItr::Mode const eMode(
812+
(pRootFrame && pRootFrame->IsHideRedlines())
813+
? SwRedlineItr::Mode::Hide
814+
: bShow
815+
? SwRedlineItr::Mode::Show
816+
: SwRedlineItr::Mode::Ignore);
817+
// In Ignore mode, with a null ExtTextInputAttr* pArr, SwRedlineItr has
818+
// nothing to do, so skip creating it.
819+
if (eMode == SwRedlineItr::Mode::Ignore && !pArr)
820+
return;
811821
m_pRedline.reset(new SwRedlineItr( rTextNode, *m_pFont, m_aAttrHandler, nRedlPos,
812-
(pRootFrame && pRootFrame->IsHideRedlines())
813-
? SwRedlineItr::Mode::Hide
814-
: bShow
815-
? SwRedlineItr::Mode::Show
816-
: SwRedlineItr::Mode::Ignore,
817-
pArr, pExtInp ? pExtInp->Start() : nullptr));
822+
eMode, pArr, pExtInp ? pExtInp->Start() : nullptr));
818823

819824
if( m_pRedline->IsOn() )
820825
++m_nChgCnt;

0 commit comments

Comments
 (0)