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

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 15 06:30:02 UTC 2018


 vcl/source/window/splitwin.cxx |   19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

New commits:
commit 2849b82894f4325021162605fb911bcb27fb8fca
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Jan 12 08:33:52 2018 +0200

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

diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 23b11f52ffe4..5e8c26c094eb 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -85,8 +85,8 @@ public:
     ~ImplSplitSet();
 
     std::vector< ImplSplitItem > mvItems;
-    Wallpaper*          mpWallpaper;
-    Bitmap*             mpBitmap;
+    std::unique_ptr<Wallpaper>   mpWallpaper;
+    std::unique_ptr<Bitmap>      mpBitmap;
     long                mnLastSize;
     long                mnSplitSize;
     sal_uInt16          mnId;
@@ -128,15 +128,8 @@ ImplSplitSet::ImplSplitSet() :
 
 ImplSplitSet::~ImplSplitSet()
 {
-    if ( mpWallpaper ) {
-        delete mpWallpaper;
-        mpWallpaper = nullptr;
-    }
-
-    if ( mpBitmap ) {
-        delete mpBitmap;
-        mpBitmap = nullptr;
-    }
+    mpWallpaper.reset();
+    mpBitmap.reset();
 }
 
 /** Check whether the given size is inside the valid range defined by
@@ -944,7 +937,7 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet*
                             mnDX - mnRightBorder - 1,
                             mnDY - mnBottomBorder - 1);
 
-            ImplDrawBack(rRenderContext, aRect, pSet->mpWallpaper, pSet->mpBitmap);
+            ImplDrawBack(rRenderContext, aRect, pSet->mpWallpaper.get(), pSet->mpBitmap.get());
         }
     }
 
@@ -958,7 +951,7 @@ void SplitWindow::ImplDrawBack(vcl::RenderContext& rRenderContext, ImplSplitSet*
                 Point aPoint(rItems[i].mnLeft, rItems[i].mnTop);
                 Size aSize(rItems[i].mnWidth, rItems[i].mnHeight);
                 tools::Rectangle aRect(aPoint, aSize);
-                ImplDrawBack(rRenderContext, aRect, pSet->mpWallpaper, pSet->mpBitmap);
+                ImplDrawBack(rRenderContext, aRect, pSet->mpWallpaper.get(), pSet->mpBitmap.get());
             }
         }
     }


More information about the Libreoffice-commits mailing list