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

Stephan Bergmann sbergman at redhat.com
Wed Jun 14 16:44:52 UTC 2017


 sw/source/filter/html/htmlctxt.cxx |    5 +++--
 sw/source/filter/html/swhtml.hxx   |    8 +++-----
 2 files changed, 6 insertions(+), 7 deletions(-)

New commits:
commit 0646f3ef7cd036b899f7b8ef3a897eecb298994c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Jun 14 18:44:26 2017 +0200

    Use unique_ptr for HTMLAttrContext::pFrameItemSet
    
    Change-Id: I90d0461be7b9df1200bc3eef6ae1d6dbb20f7c5b

diff --git a/sw/source/filter/html/htmlctxt.cxx b/sw/source/filter/html/htmlctxt.cxx
index 423f2b670155..c575f209e6bb 100644
--- a/sw/source/filter/html/htmlctxt.cxx
+++ b/sw/source/filter/html/htmlctxt.cxx
@@ -18,6 +18,7 @@
  */
 
 #include "hintids.hxx"
+#include <o3tl/make_unique.hxx>
 #include <svl/itemiter.hxx>
 #include <editeng/lrspitem.hxx>
 #include <editeng/ulspitem.hxx>
@@ -702,9 +703,9 @@ void SwHTMLParser::SplitPREListingXMP( HTMLAttrContext *pCntxt )
 SfxItemSet *HTMLAttrContext::GetFrameItemSet( SwDoc *pCreateDoc )
 {
     if( !pFrameItemSet && pCreateDoc )
-        pFrameItemSet = new SfxItemSet( pCreateDoc->GetAttrPool(),
+        pFrameItemSet = o3tl::make_unique<SfxItemSet>( pCreateDoc->GetAttrPool(),
                         RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
-    return pFrameItemSet;
+    return pFrameItemSet.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index a1ef95e54d8c..d38ff1ffeb15 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -201,7 +201,7 @@ class HTMLAttrContext
     OUString    aClass;          // context class
 
     HTMLAttrContext_SaveDoc *pSaveDocContext;
-    SfxItemSet *pFrameItemSet;
+    std::unique_ptr<SfxItemSet> pFrameItemSet;
 
     HtmlTokenId nToken;         // the token of the context
 
@@ -233,7 +233,6 @@ public:
                       bool bDfltColl=false ) :
         aClass( rClass ),
         pSaveDocContext( nullptr ),
-        pFrameItemSet( nullptr ),
         nToken( nTokn ),
         nTextFormatColl( nPoolId ),
         nLeftMargin( 0 ),
@@ -255,7 +254,6 @@ public:
 
     explicit HTMLAttrContext( HtmlTokenId nTokn ) :
         pSaveDocContext( nullptr ),
-        pFrameItemSet( nullptr ),
         nToken( nTokn ),
         nTextFormatColl( 0 ),
         nLeftMargin( 0 ),
@@ -275,7 +273,7 @@ public:
         bRestartListing( false )
     {}
 
-    ~HTMLAttrContext() { ClearSaveDocContext(); delete pFrameItemSet; }
+    ~HTMLAttrContext() { ClearSaveDocContext(); }
 
     HtmlTokenId GetToken() const { return nToken; }
 
@@ -307,7 +305,7 @@ public:
     bool HasSaveDocContext() const { return pSaveDocContext!=nullptr; }
     HTMLAttrContext_SaveDoc *GetSaveDocContext( bool bCreate=false );
 
-    const SfxItemSet *GetFrameItemSet() const { return pFrameItemSet; }
+    const SfxItemSet *GetFrameItemSet() const { return pFrameItemSet.get(); }
     SfxItemSet *GetFrameItemSet( SwDoc *pCreateDoc );
 
     void SetFinishPREListingXMP( bool bSet ) { bFinishPREListingXMP = bSet; }


More information about the Libreoffice-commits mailing list