summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-04-02 20:20:10 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2022-05-13 14:14:26 +0200
commit3176a7cf617593f402e377feb2b23b63e5d191e1 (patch)
tree6c04ee99220e08b7729c3e78d1292283eb7b1d62
parentf0416a5215ae80822d1689f080b8eb1f675d007d (diff)
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 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132462 Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> Tested-by: Jenkins (cherry picked from commit 37f39a4156069ba5f099045ce93370507d9ba215) (cherry picked from commit 65f16bbd7092f924879cb67e39bd4e826abe5a86) Change-Id: Ie52aab7e5933d76b0c055389798104e4d93f39e9
-rw-r--r--sw/source/core/layout/tabfrm.cxx42
1 files changed, 26 insertions, 16 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index c4f7838e2a30..05d189103d2f 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -1956,8 +1956,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
pAccess.reset();
m_bCalcLowers |= pLayout->Resize(
pLayout->GetBrowseWidthByTabFrame( *this ) );
- pAccess = o3tl::make_unique<SwBorderAttrAccess>(SwFrame::GetCache(), this);
- pAttrs = pAccess->Get();
}
setFramePrintAreaValid(false);
@@ -1990,6 +1988,12 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
const long nOldPrtWidth = aRectFnSet.GetWidth(getFramePrintArea());
const long nOldFrameWidth = aRectFnSet.GetWidth(getFrameArea());
const Point aOldPrtPos = aRectFnSet.GetPos(getFramePrintArea());
+
+ if (!pAccess)
+ {
+ pAccess = o3tl::make_unique<SwBorderAttrAccess>(SwFrame::GetCache(), this);
+ pAttrs = pAccess->Get();
+ }
Format( getRootFrame()->GetCurrShell()->GetOut(), pAttrs );
SwHTMLTableLayout *pLayout = GetTable()->GetHTMLTableLayout();
@@ -2000,8 +2004,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
pAccess.reset();
m_bCalcLowers |= pLayout->Resize(
pLayout->GetBrowseWidthByTabFrame( *this ) );
- pAccess = o3tl::make_unique<SwBorderAttrAccess>(SwFrame::GetCache(), this);
- pAttrs = pAccess->Get();
}
if ( aOldPrtPos != aRectFnSet.GetPos(getFramePrintArea()) )
aNotify.SetLowersComplete( false );
@@ -2050,15 +2052,22 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
pAccess.reset();
m_bCalcLowers |= pHTMLLayout->Resize(
pHTMLLayout->GetBrowseWidthByTabFrame( *this ) );
+ }
+
+ setFramePrintAreaValid(false);
+ if (!pAccess)
+ {
pAccess = o3tl::make_unique<SwBorderAttrAccess>(SwFrame::GetCache(), this);
pAttrs = pAccess->Get();
}
-
- setFramePrintAreaValid(false);
Format( getRootFrame()->GetCurrShell()->GetOut(), pAttrs );
}
+
+ pAccess.reset();
+
lcl_RecalcTable( *this, nullptr, aNotify );
+
m_bLowersFormatted = true;
if ( bKeep && KEEPTAB )
{
@@ -2222,11 +2231,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 (!pAccess)
+ {
+ pAccess = o3tl::make_unique<SwBorderAttrAccess>(SwFrame::GetCache(), this);
+ pAttrs = pAccess->Get();
+ }
+ if (IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), true)
+ && pLastRow->ShouldRowKeepWithNext())
+ {
+ bFormat = true;
+ }
}
}
@@ -2240,9 +2256,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
// is found, get its first content.
const SwFrame* pTmpNxt = sw_FormatNextContentForKeep( this );
- pAccess = o3tl::make_unique<SwBorderAttrAccess>(SwFrame::GetCache(), this);
- pAttrs = pAccess->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:
@@ -2485,9 +2498,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext)
GetFollow()->MakeAll(pRenderContext);
- pAccess = o3tl::make_unique<SwBorderAttrAccess>(SwFrame::GetCache(), this);
- pAttrs = pAccess->Get();
-
GetFollow()->SetLowersFormatted(false);
// #i43913# - lock follow table
// to avoid its formatting during the format of