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

Stephan Bergmann sbergman at redhat.com
Tue Jun 13 09:20:26 UTC 2017


 cui/source/dialogs/cuihyperdlg.cxx |   10 ++++++----
 cui/source/inc/cuihyperdlg.hxx     |    6 +++++-
 2 files changed, 11 insertions(+), 5 deletions(-)

New commits:
commit d57c9d81aab1e02d257738a82bddeca78db46da8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Jun 13 11:19:58 2017 +0200

    Use unique_ptr for SvxHpLinkDlg::mpItemSet
    
    Change-Id: I6ad2669afe3853196bb1fce9c7c81af640831116

diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index 09810b34b8b5..eb8e9515b759 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <o3tl/make_unique.hxx>
 #include <vcl/settings.hxx>
 #include <unotools/viewoptions.hxx>
 #include "cuihyperdlg.hxx"
@@ -115,13 +118,13 @@ SvxHpLinkDlg::SvxHpLinkDlg (vcl::Window* pParent, SfxBindings* pBindings)
     GetCancelButton().SetText ( CuiResId(RID_SVXSTR_HYPDLG_CLOSEBUT) );
 
     // create itemset for tabpages
-    mpItemSet = new SfxItemSet( SfxGetpApp()->GetPool(), SID_HYPERLINK_GETLINK,
+    mpItemSet = o3tl::make_unique<SfxItemSet>( SfxGetpApp()->GetPool(), SID_HYPERLINK_GETLINK,
                                SID_HYPERLINK_SETLINK );
 
     SvxHyperlinkItem aItem(SID_HYPERLINK_GETLINK);
     mpItemSet->Put(aItem);
 
-    SetInputSet (mpItemSet);
+    SetInputSet (mpItemSet.get());
 
     //loop through the pages and get their max bounds and lock that down
     ShowPage(RID_SVXPAGE_HYPERLINK_NEWDOCUMENT);
@@ -165,8 +168,7 @@ void SvxHpLinkDlg::dispose()
     SvtViewOptions aViewOpt( EViewType::TabDialog, OUString::number(SID_HYPERLINK_DIALOG) );
     aViewOpt.Delete();
 
-    delete mpItemSet;
-    mpItemSet = nullptr;
+    mpItemSet.reset();
 
     maCtrl.dispose();
 
diff --git a/cui/source/inc/cuihyperdlg.hxx b/cui/source/inc/cuihyperdlg.hxx
index 19feaf2aaeac..897d30a09aed 100644
--- a/cui/source/inc/cuihyperdlg.hxx
+++ b/cui/source/inc/cuihyperdlg.hxx
@@ -20,6 +20,10 @@
 #ifndef INCLUDED_CUI_SOURCE_INC_CUIHYPERDLG_HXX
 #define INCLUDED_CUI_SOURCE_INC_CUIHYPERDLG_HXX
 
+#include <sal/config.h>
+
+#include <memory>
+
 #include <svx/hlnkitem.hxx>
 #include <sfx2/childwin.hxx>
 #include <sfx2/ctrlitem.hxx>
@@ -62,7 +66,7 @@ class SvxHpLinkDlg : public IconChoiceDialog
 private:
     SvxHlinkCtrl        maCtrl;         ///< Controller
     SfxBindings*        mpBindings;
-    SfxItemSet*         mpItemSet;
+    std::unique_ptr<SfxItemSet> mpItemSet;
 
     bool            mbGrabFocus : 1;
     bool            mbReadOnly  : 1;


More information about the Libreoffice-commits mailing list