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

Noel Grandin noel.grandin at collabora.co.uk
Wed May 2 06:27:17 UTC 2018


 include/svx/scene3d.hxx          |    3 ++-
 svx/source/engine3d/scene3d.cxx  |    8 ++------
 svx/source/gallery2/galbrws1.cxx |   10 ++++------
 svx/source/gallery2/galbrws1.hxx |    4 ++--
 4 files changed, 10 insertions(+), 15 deletions(-)

New commits:
commit e43764452e3e2a8b0acb197d6eff2cb9fc76772a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue May 1 17:57:47 2018 +0200

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

diff --git a/svx/source/gallery2/galbrws1.cxx b/svx/source/gallery2/galbrws1.cxx
index 7a8525c25990..4958e41f3ae5 100644
--- a/svx/source/gallery2/galbrws1.cxx
+++ b/svx/source/gallery2/galbrws1.cxx
@@ -150,8 +150,7 @@ void GalleryBrowser1::dispose()
     EndListening( *mpGallery );
     mpThemePropertiesDialog.clear();
     mpThemes.disposeAndClear();
-    delete mpExchangeData;
-    mpExchangeData = nullptr;
+    mpExchangeData.reset();
     maNewTheme.disposeAndClear();
     Control::dispose();
 }
@@ -259,14 +258,14 @@ void GalleryBrowser1::ImplGetExecuteVector(std::vector<OString>& o_aExec)
 void GalleryBrowser1::ImplGalleryThemeProperties( const OUString & rThemeName, bool bCreateNew )
 {
     DBG_ASSERT(!mpThemePropsDlgItemSet, "mpThemePropsDlgItemSet already set!");
-    mpThemePropsDlgItemSet = new SfxItemSet( SfxGetpApp()->GetPool() );
+    mpThemePropsDlgItemSet.reset(new SfxItemSet( SfxGetpApp()->GetPool() ));
     GalleryTheme*   pTheme = mpGallery->AcquireTheme( rThemeName, *this );
 
     ImplFillExchangeData( pTheme, *mpExchangeData );
 
     SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
     assert(pFact && "Got no AbstractDialogFactory!");
-    mpThemePropertiesDialog = pFact->CreateGalleryThemePropertiesDialog(this, mpExchangeData, mpThemePropsDlgItemSet);
+    mpThemePropertiesDialog = pFact->CreateGalleryThemePropertiesDialog(this, mpExchangeData.get(), mpThemePropsDlgItemSet.get());
     assert(mpThemePropertiesDialog && "Got no GalleryThemePropertiesDialog!");
 
     if ( bCreateNew )
@@ -336,8 +335,7 @@ IMPL_LINK( GalleryBrowser1, EndThemePropertiesDlgHdl, Dialog&, /*rDialog*/, void
 IMPL_LINK( GalleryBrowser1, DestroyThemePropertiesDlgHdl, void*, /*p*/, void )
 {
     mpThemePropertiesDialog.disposeAndClear();
-    delete mpThemePropsDlgItemSet;
-    mpThemePropsDlgItemSet = nullptr;
+    mpThemePropsDlgItemSet.reset();
 }
 
 void GalleryBrowser1::ImplExecute(const OString &rIdent)
diff --git a/svx/source/gallery2/galbrws1.hxx b/svx/source/gallery2/galbrws1.hxx
index 858a9559c17a..24f6ada7aade 100644
--- a/svx/source/gallery2/galbrws1.hxx
+++ b/svx/source/gallery2/galbrws1.hxx
@@ -78,8 +78,8 @@ private:
     VclPtr<GalleryThemeListBox>  mpThemes;
     VclPtr<VclAbstractDialog2>   mpThemePropertiesDialog; // to keep it alive during execution
     Gallery*                mpGallery;
-    ExchangeData*           mpExchangeData;
-    SfxItemSet*             mpThemePropsDlgItemSet;
+    std::unique_ptr<ExchangeData> mpExchangeData;
+    std::unique_ptr<SfxItemSet>   mpThemePropsDlgItemSet;
 
     Image                   aImgNormal;
     Image                   aImgDefault;
commit 18b5b3ae444209b2e4476411194896ae917a2beb
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Apr 30 19:17:27 2018 +0200

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

diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx
index c3412eeeef64..57c79e7e1bec 100644
--- a/include/svx/scene3d.hxx
+++ b/include/svx/scene3d.hxx
@@ -24,6 +24,7 @@
 #include <tools/b3dtrans.hxx>
 #include <svx/svxdllapi.h>
 #include <svx/obj3d.hxx>
+#include <memory>
 
 namespace sdr { namespace properties {
     class BaseProperties;
@@ -70,7 +71,7 @@ protected:
     B3dCamera                   aCameraSet;
     Camera3D                    aCamera;
 
-    Imp3DDepthRemapper*         mp3DDepthRemapper;
+    mutable std::unique_ptr<Imp3DDepthRemapper> mp3DDepthRemapper;
 
     // Flag to determine if only selected objects should be drawn
     bool                        bDrawOnlySelected       : 1;
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 5992fbae38b6..b3c9a401e3c4 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -233,11 +233,7 @@ basegfx::B2DPolyPolygon E3dScene::TakeXorPoly() const
 
 void E3dScene::ImpCleanup3DDepthMapper()
 {
-    if(mp3DDepthRemapper)
-    {
-        delete mp3DDepthRemapper;
-        mp3DDepthRemapper = nullptr;
-    }
+    mp3DDepthRemapper.reset();
 }
 
 sal_uInt32 E3dScene::RemapOrdNum(sal_uInt32 nNewOrdNum) const
@@ -248,7 +244,7 @@ sal_uInt32 E3dScene::RemapOrdNum(sal_uInt32 nNewOrdNum) const
 
         if(nObjCount > 1)
         {
-            const_cast<E3dScene*>(this)->mp3DDepthRemapper = new Imp3DDepthRemapper(*this);
+            mp3DDepthRemapper.reset(new Imp3DDepthRemapper(*this));
         }
     }
 


More information about the Libreoffice-commits mailing list