[Libreoffice-commits] core.git: sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 20 10:30:20 UTC 2021


 sw/source/core/frmedt/fefly1.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit e2e43363b429b7909ed3dbe79ccab35d0274106e
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Sep 19 21:02:25 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Sep 20 12:29:46 2021 +0200

    no need to allocate these SfxItemSet on the heap
    
    Change-Id: I1703ee1d7cfc5f3f3458dce8db36fa86c578814c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122331
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index a453e9906c65..821b5b53e5ff 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1244,19 +1244,19 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi
     SwFlyFrameFormat* pFlyFormat = pFly->GetFormat();
     const Point aPt( pFly->getFrameArea().Pos() );
 
-    std::unique_ptr<SfxItemSet> pSet;
+    std::optional<SfxItemSet> oSet;
     const SfxPoolItem* pItem;
     if( SfxItemState::SET == pNewFormat->GetItemState( RES_ANCHOR, false, &pItem ))
     {
-        pSet.reset(new SfxItemSet( GetDoc()->GetAttrPool(), aFrameFormatSetRange ));
-        pSet->Put( *pItem );
-        if( !sw_ChkAndSetNewAnchor( *pFly, *pSet ))
+        oSet.emplace( GetDoc()->GetAttrPool(), aFrameFormatSetRange );
+        oSet->Put( *pItem );
+        if( !sw_ChkAndSetNewAnchor( *pFly, *oSet ))
         {
-            pSet.reset();
+            oSet.reset();
         }
     }
 
-    if( GetDoc()->SetFrameFormatToFly( *pFlyFormat, *pNewFormat, pSet.get(), bKeepOrient ))
+    if( GetDoc()->SetFrameFormatToFly( *pFlyFormat, *pNewFormat, oSet ? &*oSet : nullptr, bKeepOrient ))
     {
         SwFlyFrame* pFrame = pFlyFormat->GetFrame( &aPt );
         if( pFrame )
@@ -1264,7 +1264,7 @@ void SwFEShell::SetFrameFormat( SwFrameFormat *pNewFormat, bool bKeepOrient, Poi
         else
             GetLayout()->SetAssertFlyPages();
     }
-    pSet.reset();
+    oSet.reset();
 
     EndAllActionAndCall();
 }


More information about the Libreoffice-commits mailing list