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

Noel Grandin noel.grandin at collabora.co.uk
Mon Apr 23 06:15:53 UTC 2018


 include/vcl/ctrl.hxx           |    3 ++-
 include/vcl/floatwin.hxx       |    3 ++-
 vcl/source/control/ctrl.cxx    |    5 ++---
 vcl/source/window/floatwin.cxx |    5 ++---
 4 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit 8e0e2b7dd8d478c443351d0ea7ce271f7e839825
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Apr 16 12:46:55 2018 +0200

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

diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index 6ebb5c84cf37..5e5cfac0d3ac 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -24,6 +24,7 @@
 #include <vcl/dllapi.h>
 #include <vcl/syswin.hxx>
 #include <o3tl/typed_flags_set.hxx>
+#include <memory>
 
 class ToolBox;
 
@@ -86,7 +87,7 @@ private:
     VclPtr<FloatingWindow>  mpNextFloat;
     VclPtr<vcl::Window>     mpFirstPopupModeWin;
     VclPtr<vcl::Window>     mxPrevFocusWin;
-    ImplData*       mpImplData;
+    std::unique_ptr<ImplData> mpImplData;
     tools::Rectangle       maFloatRect;
     ImplSVEvent *   mnPostId;
     FloatWinPopupFlags   mnPopupModeFlags;
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index f7b68203b67c..19c8ed1b5748 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -54,7 +54,7 @@ tools::Rectangle& FloatingWindow::ImplGetItemEdgeClipRect()
 
 void FloatingWindow::ImplInit( vcl::Window* pParent, WinBits nStyle )
 {
-    mpImplData = new ImplData;
+    mpImplData.reset(new ImplData);
 
     mpWindowImpl->mbFloatWin = true;
     mbInCleanUp = false;
@@ -216,8 +216,7 @@ void FloatingWindow::dispose()
         mnPostId = nullptr;
     }
 
-    delete mpImplData;
-    mpImplData = nullptr;
+    mpImplData.reset();
 
     mpNextFloat.clear();
     mpFirstPopupModeWin.clear();
commit e7197e9dc18dd00f1e553edfd163a0570ecde977
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Apr 16 12:31:57 2018 +0200

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

diff --git a/include/vcl/ctrl.hxx b/include/vcl/ctrl.hxx
index cb68cfe8f78a..5529cf86b912 100644
--- a/include/vcl/ctrl.hxx
+++ b/include/vcl/ctrl.hxx
@@ -25,6 +25,7 @@
 #include <vcl/dllapi.h>
 #include <vcl/window.hxx>
 #include <vcl/salnativewidgets.hxx>
+#include <memory>
 
 // forward
 namespace vcl { struct ImplControlData; struct ControlLayoutData; }
@@ -34,7 +35,7 @@ class StyleSettings;
 class VCL_DLLPUBLIC Control : public vcl::Window
 {
 protected:
-    vcl::ImplControlData* mpControlData;
+    std::unique_ptr<vcl::ImplControlData> mpControlData;
 
 private:
     bool                    mbHasControlFocus;
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index f0f38ac32178..8febfb02975d 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -39,7 +39,7 @@ void Control::ImplInitControlData()
 {
     mbHasControlFocus       = false;
     mbShowAccelerator       = false;
-    mpControlData   = new ImplControlData;
+    mpControlData.reset(new ImplControlData);
 }
 
 Control::Control( WindowType nType ) :
@@ -62,8 +62,7 @@ Control::~Control()
 
 void Control::dispose()
 {
-    delete mpControlData;
-    mpControlData = nullptr;
+    mpControlData.reset();
     Window::dispose();
 }
 


More information about the Libreoffice-commits mailing list