summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-09-26 08:40:21 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-26 13:31:13 +0200
commitaad712f6362378f19db2062f0499fd039c2f7114 (patch)
treea301c3674a737790f97fe6d1fb2e73575970293f /sw
parenta7f5225f2900fcb21ed5565de1b606b3c3e1c81c (diff)
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@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/calcmove.cxx4
-rw-r--r--sw/source/core/layout/flowfrm.cxx6
2 files changed, 6 insertions, 4 deletions
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;