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

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


 include/svx/bmpmask.hxx        |    3 ++-
 include/svx/measctrl.hxx       |    3 ++-
 svx/source/dialog/_bmpmask.cxx |   25 ++++++++++++-------------
 svx/source/dialog/measctrl.cxx |    4 ++--
 4 files changed, 18 insertions(+), 17 deletions(-)

New commits:
commit 3a83f9726044dac1e1f211ab1c5a33d8fe4cbc0b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu May 31 10:31:08 2018 +0200

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

diff --git a/include/svx/measctrl.hxx b/include/svx/measctrl.hxx
index 09b861703ee4..4cdbb84a60e5 100644
--- a/include/svx/measctrl.hxx
+++ b/include/svx/measctrl.hxx
@@ -21,6 +21,7 @@
 
 #include <vcl/ctrl.hxx>
 #include <svx/svxdllapi.h>
+#include <memory>
 
 class SfxItemSet;
 class SdrMeasureObj;
@@ -32,7 +33,7 @@ class SVX_DLLPUBLIC SvxXMeasurePreview : public Control
 
 private:
     SdrMeasureObj* pMeasureObj;
-    SdrModel* pModel;
+    std::unique_ptr<SdrModel> pModel;
 
 public:
     SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle);
diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx
index b4fdf30ad4bb..635802210955 100644
--- a/svx/source/dialog/measctrl.cxx
+++ b/svx/source/dialog/measctrl.cxx
@@ -41,7 +41,7 @@ SvxXMeasurePreview::SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle)
     Point aPt1 = Point(aSize.Width() / 5, static_cast<long>(aSize.Height() / 2));
     Point aPt2 = Point(aSize.Width() * 4 / 5, static_cast<long>(aSize.Height() / 2));
 
-    pModel = new SdrModel();
+    pModel.reset(new SdrModel());
     pMeasureObj = new SdrMeasureObj(
         *pModel,
         aPt1,
@@ -88,7 +88,7 @@ void SvxXMeasurePreview::dispose()
     SdrObject* pTemp(pMeasureObj);
     SdrObject::Free(pTemp);
 
-    delete pModel;
+    pModel.reset();
     Control::dispose();
 }
 
commit 905a2bddaab5bc8fc552f019864330fa30e2088b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu May 31 10:28:13 2018 +0200

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

diff --git a/include/svx/bmpmask.hxx b/include/svx/bmpmask.hxx
index a471ffcf880a..2b88d7dd3144 100644
--- a/include/svx/bmpmask.hxx
+++ b/include/svx/bmpmask.hxx
@@ -33,6 +33,7 @@
 #include <vcl/gdimtf.hxx>
 #include <vcl/graph.hxx>
 #include <vcl/vclptr.hxx>
+#include <memory>
 
 namespace vcl { class Window; }
 
@@ -121,7 +122,7 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxBmpMask : public SfxDockingWindow
     VclPtr<MetricField>        m_pSp4;
     VclPtr<SvxColorListBox>    m_pLbColor4;
 
-    MaskData*           pData;
+    std::unique_ptr<MaskData>  pData;
     VclPtr<CheckBox>           m_pCbxTrans;
     VclPtr<SvxColorListBox>    m_pLbColorTrans;
 
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index a6522e6cb100..aa0eb74fd046 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -408,21 +408,21 @@ SvxBmpMask::SvxBmpMask(SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window*
     m_pLbColor3->SelectEntry(COL_TRANSPARENT);
     m_pLbColor4->SelectEntry(COL_TRANSPARENT);
 
-    m_pTbxPipette->SetSelectHdl( LINK( pData, MaskData, PipetteHdl ) );
-    m_pBtnExec->SetClickHdl( LINK( pData, MaskData, ExecHdl ) );
+    m_pTbxPipette->SetSelectHdl( LINK( pData.get(), MaskData, PipetteHdl ) );
+    m_pBtnExec->SetClickHdl( LINK( pData.get(), MaskData, ExecHdl ) );
 
-    m_pCbx1->SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
-    m_pCbx2->SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
-    m_pCbx3->SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
-    m_pCbx4->SetClickHdl( LINK( pData, MaskData, CbxHdl ) );
-    m_pCbxTrans->SetClickHdl( LINK( pData, MaskData, CbxTransHdl ) );
+    m_pCbx1->SetClickHdl( LINK( pData.get(), MaskData, CbxHdl ) );
+    m_pCbx2->SetClickHdl( LINK( pData.get(), MaskData, CbxHdl ) );
+    m_pCbx3->SetClickHdl( LINK( pData.get(), MaskData, CbxHdl ) );
+    m_pCbx4->SetClickHdl( LINK( pData.get(), MaskData, CbxHdl ) );
+    m_pCbxTrans->SetClickHdl( LINK( pData.get(), MaskData, CbxTransHdl ) );
 
     SetAccessibleNames ();
 
-    m_pLbColor1->SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
-    m_pLbColor2->SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
-    m_pLbColor3->SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
-    m_pLbColor4->SetGetFocusHdl( LINK( pData, MaskData, FocusLbHdl ) );
+    m_pLbColor1->SetGetFocusHdl( LINK( pData.get(), MaskData, FocusLbHdl ) );
+    m_pLbColor2->SetGetFocusHdl( LINK( pData.get(), MaskData, FocusLbHdl ) );
+    m_pLbColor3->SetGetFocusHdl( LINK( pData.get(), MaskData, FocusLbHdl ) );
+    m_pLbColor4->SetGetFocusHdl( LINK( pData.get(), MaskData, FocusLbHdl ) );
     m_pLbColorTrans->Disable();
 
     OUString sColorPalette (SvxResId( RID_SVXDLG_BMPMASK_STR_PALETTE));
@@ -474,8 +474,7 @@ void SvxBmpMask::dispose()
     m_pQSet3.disposeAndClear();
     m_pQSet4.disposeAndClear();
     m_pCtlPipette.disposeAndClear();
-    delete pData;
-    pData = nullptr;
+    pData.reset();
     m_pTbxPipette.clear();
     m_pBtnExec.clear();
     m_pCbx1.clear();


More information about the Libreoffice-commits mailing list