sw/qa/extras/layout/data/tdf152983-1-min.docx |binary sw/qa/extras/layout/layout.cxx | 6 ++++++ sw/source/core/layout/wsfrm.cxx | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-)
New commits: commit ce863cf085e093e7385818a7d6d598a161e33a28 Author: Michael Stahl <[email protected]> AuthorDate: Thu Jun 1 20:19:36 2023 +0200 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Jun 23 22:51:07 2023 +0200 tdf#152983 sw: layout: fix crash in SwContentFrame::Cut() Surprisingly, SwContentFrame::Cut() is called in a situation where the frame is not connected to any SwPageFrame yet - it is in a follow fly of a fly chain that is anchored in a footer, and SwFlyFrame::ChainFrames() removes it. (regression from commit b9ef71476fd70bc13f50ebe80390e0730d1b7afb) Change-Id: Iad84b7b422126e050493dc3b181d47c4dca2fae2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152510 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit d3b64de9581bd5e36ced007ff2e9139bd0343a35) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152533 Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sw/qa/extras/layout/data/tdf152983-1-min.docx b/sw/qa/extras/layout/data/tdf152983-1-min.docx new file mode 100644 index 000000000000..804e8fefe68f Binary files /dev/null and b/sw/qa/extras/layout/data/tdf152983-1-min.docx differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index d4979120be0e..b4101e9f033e 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -1265,6 +1265,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf150606) } #endif +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf152983) +{ + //just care it doesn't crash/assert + createSwDoc("tdf152983-1-min.docx"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, TestTdf137025) { // Check the padding of the textbox diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index f753a993aceb..c59717f94901 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -1227,10 +1227,11 @@ void SwContentFrame::Cut() // RemoveSuperfluous can only remove empty pages at the end; // find if there are pages without content following pPage // and if so request a call to CheckPageDescs() - SwPageFrame const* pNext(pPage); SwViewShell *pSh = pRoot->GetCurrShell(); - if (pSh && pSh->Imp()->IsAction()) + // tdf#152983 pPage is null when called from SwHeadFootFrame ctor + if (pPage && pSh && pSh->Imp()->IsAction()) { + SwPageFrame const* pNext(pPage); while ((pNext = static_cast<SwPageFrame const*>(pNext->GetNext()))) { if (!sw::IsPageFrameEmpty(*pNext) && !pNext->IsFootnotePage())
