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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jul 25 10:04:17 UTC 2018


 sw/source/uibase/frmdlg/colex.cxx |   10 +++++++---
 sw/source/uibase/inc/colex.hxx    |    8 ++------
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 5da6001918536d3d4c71410ea7e28caf3192897d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jul 24 11:10:00 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 25 12:03:48 2018 +0200

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

diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx
index af1d833346d5..493d96cc3090 100644
--- a/sw/source/uibase/frmdlg/colex.cxx
+++ b/sw/source/uibase/frmdlg/colex.cxx
@@ -496,6 +496,10 @@ Size SwColumnOnlyExample::GetOptimalSize() const
     return LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont));
 }
 
+SwPageGridExample::SwPageGridExample(vcl::Window* pPar)
+    : SwPageExample(pPar)
+{}
+
 SwPageGridExample::~SwPageGridExample()
 {
     disposeOnce();
@@ -503,7 +507,7 @@ SwPageGridExample::~SwPageGridExample()
 
 void SwPageGridExample::dispose()
 {
-    delete pGridItem;
+    pGridItem.reset();
     SwPageExample::dispose();
 }
 
@@ -609,10 +613,10 @@ void SwPageGridExample::DrawPage(vcl::RenderContext& rRenderContext, const Point
 
 void SwPageGridExample::UpdateExample( const SfxItemSet& rSet )
 {
-    DELETEZ(pGridItem);
+    pGridItem.reset();
     //get the grid information
     if(SfxItemState::DEFAULT <= rSet.GetItemState(RES_TEXTGRID))
-        pGridItem = static_cast<SwTextGridItem*>(rSet.Get(RES_TEXTGRID).Clone());
+        pGridItem.reset(static_cast<SwTextGridItem*>(rSet.Get(RES_TEXTGRID).Clone()));
     SwPageExample::UpdateExample(rSet);
 }
 
diff --git a/sw/source/uibase/inc/colex.hxx b/sw/source/uibase/inc/colex.hxx
index db65f85f13b2..4aa5d2ec3487 100644
--- a/sw/source/uibase/inc/colex.hxx
+++ b/sw/source/uibase/inc/colex.hxx
@@ -47,18 +47,14 @@ class SwTextGridItem;
 
 class SW_DLLPUBLIC SwPageGridExample : public SwPageExample
 {
-    SwTextGridItem*     pGridItem;
+    std::unique_ptr<SwTextGridItem> pGridItem;
 protected:
     virtual void DrawPage(vcl::RenderContext& rRenderContext,
                           const Point& rPoint,
                           const bool bSecond,
                           const bool bEnabled) override;
 public:
-    SwPageGridExample(vcl::Window* pPar)
-        : SwPageExample(pPar)
-        , pGridItem(nullptr)
-    {}
-
+    SwPageGridExample(vcl::Window* pPar);
     virtual ~SwPageGridExample() override;
     virtual void dispose() override;
     void UpdateExample( const SfxItemSet& rSet );


More information about the Libreoffice-commits mailing list