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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 14 07:25:40 UTC 2018


 sw/source/core/text/porrst.cxx |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 9e0ee17d5059b9a7cf80c8839bb139e1626d0ebb
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 13 11:04:18 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 14 09:25:10 2018 +0200

    loplugin:useuniqueptr in SwTextFrame::EmptyHeight
    
    Change-Id: I76647a9441fee2f4d2d338a70f9bf95e80fa18ee
    Reviewed-on: https://gerrit.libreoffice.org/60451
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index 867c2b9927c2..6a8d108a1363 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -223,19 +223,19 @@ SwTwips SwTextFrame::EmptyHeight() const
     }
     OSL_ENSURE( ! IsVertical() || ! IsSwapped(),"SwTextFrame::EmptyHeight with swapped frame" );
 
-    SwFont *pFnt;
+    std::unique_ptr<SwFont> pFnt;
     const SwTextNode& rTextNode = *GetTextNodeForParaProps();
     const IDocumentSettingAccess* pIDSA = rTextNode.getIDocumentSettingAccess();
     SwViewShell *pSh = getRootFrame()->GetCurrShell();
     if ( rTextNode.HasSwAttrSet() )
     {
         const SwAttrSet *pAttrSet = &( rTextNode.GetSwAttrSet() );
-        pFnt = new SwFont( pAttrSet, pIDSA );
+        pFnt.reset(new SwFont( pAttrSet, pIDSA ));
     }
     else
     {
         SwFontAccess aFontAccess( &rTextNode.GetAnyFormatColl(), pSh);
-        pFnt = new SwFont( aFontAccess.Get()->GetFont() );
+        pFnt.reset(new SwFont( aFontAccess.Get()->GetFont() ));
         pFnt->CheckFontCacheId( pSh, pFnt->GetActual() );
     }
 
@@ -274,7 +274,6 @@ SwTwips SwTextFrame::EmptyHeight() const
         pFnt->ChgPhysFnt( pSh, *pOut );
         nRet = pFnt->GetHeight( pSh, *pOut );
     }
-    delete pFnt;
     return nRet;
 }
 


More information about the Libreoffice-commits mailing list