sw/qa/extras/layout/data/forcepoint100.html |binary sw/qa/extras/layout/data/forcepoint98.html |binary sw/qa/extras/layout/layout.cxx | 12 ++++++++ sw/source/core/layout/sectfrm.cxx | 3 +- sw/source/core/layout/tabfrm.cxx | 42 +++++++++++++++++----------- 5 files changed, 40 insertions(+), 17 deletions(-)
New commits: commit ff6ca44405e0f472441bfa3902f6a3d614028029 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Apr 1 15:49:13 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Apr 4 20:53:26 2022 +0200 forcepoint#98 don't delete SwFrame flagged as IsDeleteForbidden Change-Id: I1ac2db4bf96afc4bdc8e0646576f5fa0bcd9e410 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132435 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 3644508aceee6019842bea1fee6c177eabd61681) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132484 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/qa/extras/layout/data/forcepoint98.html b/sw/qa/extras/layout/data/forcepoint98.html new file mode 100644 index 000000000000..9d4b76c53e76 Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint98.html differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index bc80f22d0094..046b6da50650 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2548,6 +2548,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118058) pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout(); } +//just care it doesn't crash/assert +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint98) +{ + createSwWebDoc(DATA_DIRECTORY, "forcepoint98.html"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128611) { createSwDoc(DATA_DIRECTORY, "tdf128611.fodt"); diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 9b33ceeadd63..34e86e51808b 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -2885,7 +2885,8 @@ void SwRootFrame::DeleteEmptySct_() mpDestroy->erase( mpDestroy->begin() ); OSL_ENSURE( !pSect->IsColLocked() && !pSect->IsJoinLocked(), "DeleteEmptySct: Locked SectionFrame" ); - if( !pSect->getFrameArea().HasArea() && !pSect->ContainsContent() ) + SAL_WARN_IF(pSect->IsDeleteForbidden(), "sw.layout", "not allowed delete SwFrame"); + if( !pSect->getFrameArea().HasArea() && !pSect->ContainsContent() && !pSect->IsDeleteForbidden() ) { SwLayoutFrame* pUp = pSect->GetUpper(); pSect->RemoveFromLayout(); commit 697a695dbddd9bcea60e3c65de7d91e88308e557 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Apr 2 20:20:10 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Apr 4 20:53:09 2022 +0200 forcepoint#100 drop SwBorderAttrAccess to allow cache entry to be removed for SwBorderAttr which gets deleted during this call also includes... Related: forcepoint#100 we don't need pAttrs for the duration of the full scope similar to the case of commit 6b1eae0334ba8bad7656a859695551ce51b62f95 Date: Fri May 18 08:26:14 2001 +0000 Fix #87058#: Locked boraderattribut the SwCache object cannot be deleted if its locked, leading to a leak, we don't need pAttrs for the entire scope here so we can defer to the end of the scope the reacquire the lock to set pAttrs and also includes... Related: forcepoint#100 don't reacquire after every release instead release when we have to, and only reacquire if necessary before use of pAttrs Change-Id: Ie52aab7e5933d76b0c055389798104e4d93f39e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132461 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/qa/extras/layout/data/forcepoint100.html b/sw/qa/extras/layout/data/forcepoint100.html new file mode 100644 index 000000000000..6e9b83a6c95e Binary files /dev/null and b/sw/qa/extras/layout/data/forcepoint100.html differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 489518c693ef..bc80f22d0094 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -2529,6 +2529,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint94) createSwWebDoc(DATA_DIRECTORY, "forcepoint94.html"); } +//just care it doesn't crash/assert +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testForcepoint100) +{ + createSwWebDoc(DATA_DIRECTORY, "forcepoint100.html"); +} + //just care it doesn't crash/assert CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf147485Forcepoint) { diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 98f5229d4ba5..c9683f6956e4 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2059,8 +2059,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) oAccess.reset(); m_bCalcLowers |= pLayout->Resize( pLayout->GetBrowseWidthByTabFrame( *this ) ); - oAccess.emplace(SwFrame::GetCache(), this); - pAttrs = oAccess->Get(); } setFramePrintAreaValid(false); @@ -2095,6 +2093,12 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) const tools::Long nOldPrtWidth = aRectFnSet.GetWidth(getFramePrintArea()); const tools::Long nOldFrameWidth = aRectFnSet.GetWidth(getFrameArea()); const Point aOldPrtPos = aRectFnSet.GetPos(getFramePrintArea()); + + if (!oAccess) + { + oAccess.emplace(SwFrame::GetCache(), this); + pAttrs = oAccess->Get(); + } Format( getRootFrame()->GetCurrShell()->GetOut(), pAttrs ); SwHTMLTableLayout *pLayout = GetTable()->GetHTMLTableLayout(); @@ -2105,8 +2109,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) oAccess.reset(); m_bCalcLowers |= pLayout->Resize( pLayout->GetBrowseWidthByTabFrame( *this ) ); - oAccess.emplace(SwFrame::GetCache(), this); - pAttrs = oAccess->Get(); } if ( aOldPrtPos != aRectFnSet.GetPos(getFramePrintArea()) ) aNotify.SetLowersComplete( false ); @@ -2160,15 +2162,22 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) oAccess.reset(); m_bCalcLowers |= pHTMLLayout->Resize( pHTMLLayout->GetBrowseWidthByTabFrame( *this ) ); + } + + setFramePrintAreaValid(false); + if (!oAccess) + { oAccess.emplace(SwFrame::GetCache(), this); pAttrs = oAccess->Get(); } - - setFramePrintAreaValid(false); Format( getRootFrame()->GetCurrShell()->GetOut(), pAttrs ); } + + oAccess.reset(); + lcl_RecalcTable( *this, nullptr, aNotify ); + m_bLowersFormatted = true; if ( bKeep && KEEPTAB ) { @@ -2332,11 +2341,18 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) // 6. There is no section change behind the table (see IsKeep) // 7. The last table row wants to keep with its next. const SwRowFrame* pLastRow = static_cast<const SwRowFrame*>(GetLastLower()); - if (pLastRow - && IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), true) - && pLastRow->ShouldRowKeepWithNext()) + if (pLastRow) { - bFormat = true; + if (!oAccess) + { + oAccess.emplace(SwFrame::GetCache(), this); + pAttrs = oAccess->Get(); + } + if (IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), true) + && pLastRow->ShouldRowKeepWithNext()) + { + bFormat = true; + } } } @@ -2350,9 +2366,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) // is found, get its first content. const SwFrame* pTmpNxt = sw_FormatNextContentForKeep( this ); - oAccess.emplace(SwFrame::GetCache(), this); - pAttrs = oAccess->Get(); - // The last row wants to keep with the frame behind the table. // Check if the next frame is on a different page and valid. // In this case we do a magic trick: @@ -2598,9 +2611,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) GetFollow()->MakeAll(pRenderContext); - oAccess.emplace(SwFrame::GetCache(), this); - pAttrs = oAccess->Get(); - GetFollow()->SetLowersFormatted(false); // #i43913# - lock follow table // to avoid its formatting during the format of