[Libreoffice-commits] core.git: sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sun Sep 26 11:31:48 UTC 2021
sw/source/core/layout/calcmove.cxx | 4 ++--
sw/source/core/layout/flowfrm.cxx | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
New commits:
commit aad712f6362378f19db2062f0499fd039c2f7114
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Sep 26 08:40:21 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sun Sep 26 13:31:13 2021 +0200
no need to allocate these SwFrameDeleteGuard on the heap
Change-Id: Ib8b2fe4ff1309c6fb11fa50ff24ea0dd63faf0e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122617
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index f8ab0e2e29fc..98df857e3910 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1240,7 +1240,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
return;
}
- auto xDeleteGuard = std::make_unique<SwFrameDeleteGuard>(this);
+ std::optional<SwFrameDeleteGuard> oDeleteGuard(std::in_place, this);
LockJoin();
tools::Long nFormatCount = 0;
// - loop prevention
@@ -1907,7 +1907,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
pSaveFootnote.reset();
UnlockJoin();
- xDeleteGuard.reset();
+ oDeleteGuard.reset();
if ( bMovedFwd || bMovedBwd )
pNotify->SetInvaKeep();
if ( bMovedFwd )
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index dd6872c1750f..c6b075e05e00 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -1971,7 +1971,9 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways )
}
}
- std::unique_ptr<SwFrameDeleteGuard> xDeleteGuard(bMakePage ? new SwFrameDeleteGuard(pOldBoss) : nullptr);
+ std::optional<SwFrameDeleteGuard> oDeleteGuard;
+ if (bMakePage)
+ oDeleteGuard.emplace(pOldBoss);
bool bSamePage = true;
SwLayoutFrame *pNewUpper =
@@ -2011,7 +2013,7 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways )
pOldBoss = pOldBoss->FindFootnoteBossFrame( true );
SwPageFrame* pNewPage = pOldPage;
- xDeleteGuard.reset();
+ oDeleteGuard.reset();
// First, we move the footnotes.
bool bFootnoteMoved = false;
More information about the Libreoffice-commits
mailing list