sw/qa/extras/layout/data/forcepoint103.html |binary sw/qa/extras/layout/layout.cxx | 6 ++++++ sw/source/core/layout/layact.cxx | 12 +++++++++++- sw/source/core/layout/tabfrm.cxx | 1 + 4 files changed, 18 insertions(+), 1 deletion(-)
New commits: commit 934b5a9cd658be0dabe18fec0f7bc29943050bd2 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Apr 3 17:07:45 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Apr 4 20:54:38 2022 +0200 forcepoint#103 avoid crash on layout of specific html return early if the prev frame was unexpectedly deleted and another similar case to forcepoint#100 and drop a SwBorderAttrAccess to allow the cache entry to be removed in SwCache::DeleteObj Change-Id: Ia83fe8911e2f6071a28d69c3089a96e3b87cc548 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132487 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132494 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/qa/extras/layout/data/forcepoint103.html b/sw/qa/extras/layout/data/forcepoint103.html new file mode 100644 index 000000000000..006a6d340ef0 Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint103.html differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 18c766904615..9ba5927f3e41 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2547,6 +2547,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint102) createSwDoc(DATA_DIRECTORY, "forcepoint102.rtf"); } +//just care it doesn't crash/assert +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint103) +{ + createSwWebDoc(DATA_DIRECTORY, "forcepoint103.html"); +} + //just care it doesn't crash/assert CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf147485Forcepoint) { diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index da6e7c938f6b..b2b246e5eb2f 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -59,6 +59,7 @@ #include <mdiexp.hxx> #include <sectfrm.hxx> #include <acmplwrd.hxx> +#include <deletelistener.hxx> #include <sortedobjs.hxx> #include <objectformatter.hxx> #include <fntcache.hxx> @@ -1693,7 +1694,10 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage) // We do this so we don't have to search later on. const bool bNxtCnt = IsCalcLayout() && !pContent->GetFollow(); const SwContentFrame *pContentNext = bNxtCnt ? pContent->GetNextContentFrame() : nullptr; - const SwContentFrame *pContentPrev = pContent->GetPrev() ? pContent->GetPrevContentFrame() : nullptr; + SwContentFrame* const pContentPrev = pContent->GetPrev() ? pContent->GetPrevContentFrame() : nullptr; + std::optional<SfxDeleteListener> oPrevDeleteListener; + if (pContentPrev) + oPrevDeleteListener.emplace(*pContentPrev); const SwLayoutFrame*pOldUpper = pContent->GetUpper(); const SwTabFrame *pTab = pContent->FindTabFrame(); @@ -1772,6 +1776,12 @@ bool SwLayAction::FormatContent(SwPageFrame *const pPage) bool bSetContent = true; if ( pContentPrev ) { + if (oPrevDeleteListener->WasDeleted()) + { + SAL_WARN("sw", "ContentPrev was deleted"); + return false; + } + if ( !pContentPrev->isFrameAreaDefinitionValid() && pPage->IsAnLower( pContentPrev ) ) { pPage->InvalidateContent(); diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index c9683f6956e4..a650663de659 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2548,6 +2548,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) } } + oAccess.reset(); const bool bSplitError = !Split( nDeadLine, bTryToSplit, ( bTableRowKeep && !(bAllowSplitOfRow || bEmulateTableKeepSplitAllowed) ) ); // tdf#130639 don't start table on a new page after the fallback "switch off repeating header"