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

Noel Grandin noel.grandin at collabora.co.uk
Mon May 28 08:51:34 UTC 2018


 include/svx/unopage.hxx        |    3 ++-
 svx/source/unodraw/unopage.cxx |    6 +-----
 sw/inc/unodraw.hxx             |    2 +-
 3 files changed, 4 insertions(+), 7 deletions(-)

New commits:
commit 26b27c23d42247695d72167be7729e36a473f644
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri May 18 09:47:03 2018 +0200

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

diff --git a/include/svx/unopage.hxx b/include/svx/unopage.hxx
index eefc11c61b2b..1ca099d797eb 100644
--- a/include/svx/unopage.hxx
+++ b/include/svx/unopage.hxx
@@ -40,6 +40,7 @@
 #include <comphelper/servicehelper.hxx>
 
 #include <svx/unoprov.hxx>
+#include <memory>
 
 class SdrPage;
 class SdrModel;
@@ -70,7 +71,7 @@ class SVX_DLLPUBLIC SvxDrawPage : public ::cppu::WeakAggImplHelper6< css::drawin
 
     SdrPage*        mpPage;     // TTTT should be reference
     SdrModel*       mpModel;    // TTTT probably not needed -> use from SdrPage
-    SdrView*        mpView;
+    std::unique_ptr<SdrView> mpView;
 
     void    SelectObjectsInView( const css::uno::Reference< css::drawing::XShapes >& aShapes, SdrPageView*   pPageView ) throw ();
     void    SelectObjectInView( const css::uno::Reference< css::drawing::XShape >& xShape, SdrPageView*  pPageView ) throw();
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index 8f252456b107..15a3b01c5635 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -94,11 +94,7 @@ void SvxDrawPage::disposing() throw()
         mpModel = nullptr;
     }
 
-    if( mpView )
-    {
-        delete mpView;
-        mpView = nullptr;
-    }
+    mpView.reset();
     mpPage = nullptr;
 }
 
diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx
index aea0b64ce67c..3612db0b7755 100644
--- a/sw/inc/unodraw.hxx
+++ b/sw/inc/unodraw.hxx
@@ -47,7 +47,7 @@ public:
     const SdrMarkList&  PreGroup(const css::uno::Reference< css::drawing::XShapes >& rShapes);
     void                PreUnGroup(const css::uno::Reference< css::drawing::XShapeGroup >& rShapeGroup);
 
-    SdrView*            GetDrawView() {return mpView;}
+    SdrView*            GetDrawView() {return mpView.get();}
     SdrPageView*        GetPageView();
     void                RemovePageView();
     static css::uno::Reference< css::uno::XInterface >       GetInterface( SdrObject* pObj );


More information about the Libreoffice-commits mailing list