[Libreoffice-commits] core.git: 2 commits - include/svx svx/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Jun 4 06:41:07 UTC 2018


 include/svx/imapdlg.hxx       |    3 ++-
 svx/source/dialog/imapdlg.cxx |    4 ++--
 svx/source/dialog/imapwnd.cxx |    6 ++----
 svx/source/dialog/imapwnd.hxx |    5 ++---
 4 files changed, 8 insertions(+), 10 deletions(-)

New commits:
commit ad90a73e1e8889dc198b514cddaea4857541ae4f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu May 31 13:34:38 2018 +0200

    loplugin:useuniqueptr in SvxIMapDlg
    
    Change-Id: I6cbfd9c78b5bb5626a3db9ca0b6e3b51a91859a7
    Reviewed-on: https://gerrit.libreoffice.org/55234
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svx/imapdlg.hxx b/include/svx/imapdlg.hxx
index aa2c85496de8..86b5a9ae03be 100644
--- a/include/svx/imapdlg.hxx
+++ b/include/svx/imapdlg.hxx
@@ -30,6 +30,7 @@
 #include <vcl/toolbox.hxx>
 #include <vcl/status.hxx>
 #include <svx/svxdllapi.h>
+#include <memory>
 #include <vector>
 
 class ImageMap;
@@ -112,7 +113,7 @@ class SVX_DLLPUBLIC SvxIMapDlg : public SfxModelessDialog // SfxFloatingWindow
     sal_uInt16          mnCloseId;
 
     VclPtr<IMapWindow>         pIMapWnd;
-    IMapOwnData*        pOwnData;
+    std::unique_ptr<IMapOwnData> pOwnData;
     void*               pCheckObj;
     SvxIMapDlgItem      aIMapItem;
 
diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx
index 111635cabb79..76c03f8ab8b8 100644
--- a/svx/source/dialog/imapdlg.cxx
+++ b/svx/source/dialog/imapdlg.cxx
@@ -167,7 +167,7 @@ SvxIMapDlg::SvxIMapDlg(SfxBindings *_pBindings, SfxChildWindow *pCW, vcl::Window
     pIMapWnd->set_vexpand(true);
     pIMapWnd->Show();
 
-    pOwnData = new IMapOwnData;
+    pOwnData.reset(new IMapOwnData);
 
     pIMapWnd->SetInfoLink( LINK( this, SvxIMapDlg, InfoHdl ) );
     pIMapWnd->SetMousePosLink( LINK( this, SvxIMapDlg, MousePosHdl ) );
@@ -222,7 +222,7 @@ void SvxIMapDlg::dispose()
 
     // Delete URL-List
     pIMapWnd.disposeAndClear();
-    DELETEZ( pOwnData );
+    pOwnData.reset();
     m_pTbxIMapDlg1.clear();
     m_pFtURL.clear();
     m_pURLBox.clear();
commit 7b833ad64d98a9513a6e8aab0fd7daad47eb9d1d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu May 31 13:09:16 2018 +0200

    loplugin:useuniqueptr in IMapWindow
    
    Change-Id: Ibc8d2b6c9b6b463245363cc3e59e79f57a2ce360
    Reviewed-on: https://gerrit.libreoffice.org/55232
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 848180989269..e30c992e7d03 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -59,10 +59,9 @@ IMapWindow::IMapWindow( vcl::Window* pParent, WinBits nBits, const Reference< XF
 {
     SetSdrMode(true);
 
-    pItemInfo = new SfxItemInfo[ 1 ];
-    memset( pItemInfo, 0, sizeof( SfxItemInfo ) );
+    memset( maItemInfos, 0, sizeof( SfxItemInfo ) );
     pIMapPool = new SfxItemPool( "IMapItemPool",
-                                 SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, pItemInfo );
+                                 SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, maItemInfos );
     pIMapPool->FreezeIdRanges();
 }
 
@@ -74,7 +73,6 @@ IMapWindow::~IMapWindow()
 void IMapWindow::dispose()
 {
     SfxItemPool::Free(pIMapPool);
-    delete[] pItemInfo;
     GraphCtrl::dispose();
 }
 
diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx
index 4ee734ace6a4..2644bb8bd0c9 100644
--- a/svx/source/dialog/imapwnd.hxx
+++ b/svx/source/dialog/imapwnd.hxx
@@ -28,11 +28,10 @@
 #include <svtools/imap.hxx>
 #include <sfx2/frame.hxx>
 #include <svx/graphctl.hxx>
+#include <svl/itempool.hxx>
 
 #include <com/sun/star/frame/XFrame.hpp>
 
-struct SfxItemInfo;
-
 struct NotifyInfo
 {
     OUString    aMarkURL;
@@ -76,7 +75,7 @@ class IMapWindow final : public GraphCtrl, public DropTargetHelper
     TargetList          aTargetList;
     Link<IMapWindow&,void> aInfoLink;
     SfxItemPool*        pIMapPool;
-    SfxItemInfo*        pItemInfo;
+    SfxItemInfo         maItemInfos[1];
     css::uno::Reference< css::frame::XFrame >
                         mxDocumentFrame;
 


More information about the Libreoffice-commits mailing list