diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-23 09:44:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-24 08:21:33 +0200 |
commit | 070980765bc5b2fc3b59e000cdc0611ac1fb622e (patch) | |
tree | d6339699656c78517c3ad03dbcbfe2e657956ed4 | |
parent | a11b9c00b84474e1e37fa8abdfd50df87a674cf1 (diff) |
loplugin:useuniqueptr in ToolBox
Change-Id: Id2cbc7d70de2e0ddf0503448575fe2c2ca0120a0
Reviewed-on: https://gerrit.libreoffice.org/53345
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/vcl/toolbox.hxx | 7 | ||||
-rw-r--r-- | vcl/source/window/toolbox.cxx | 10 |
2 files changed, 8 insertions, 9 deletions
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx index 92382df66bce..2018be7986d4 100644 --- a/include/vcl/toolbox.hxx +++ b/include/vcl/toolbox.hxx @@ -28,6 +28,7 @@ #include <o3tl/typed_flags_set.hxx> #include <limits> +#include <memory> #include <vector> #include <com/sun/star/frame/XFrame.hpp> @@ -98,9 +99,9 @@ private: ImplToolItems::size_type mnLines; }; - ImplToolBoxPrivateData* mpData; + std::unique_ptr<ImplToolBoxPrivateData> mpData; std::vector<ImplToolSize> maFloatSizes; - Idle *mpIdle; + std::unique_ptr<Idle> mpIdle; tools::Rectangle maUpperRect; tools::Rectangle maLowerRect; tools::Rectangle maPaintRect; @@ -254,7 +255,7 @@ public: SAL_DLLPRIVATE void ImplDrawMenuButton(vcl::RenderContext& rRenderContext, bool bHighlight); SAL_DLLPRIVATE void ImplDrawButton(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bEnabled, bool bIsWindow); SAL_DLLPRIVATE ImplToolItems::size_type ImplCountLineBreaks() const; - SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData; } + SAL_DLLPRIVATE ImplToolBoxPrivateData* ImplGetToolBoxPrivateData() const { return mpData.get(); } protected: virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 1c92a392e1c2..458c7c6e9566 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -1093,7 +1093,7 @@ void ToolBox::ImplInitToolBoxData() { // initialize variables ImplGetWindowImpl()->mbToolBox = true; - mpData = new ImplToolBoxPrivateData; + mpData.reset(new ImplToolBoxPrivateData); mpFloatWin = nullptr; mnDX = 0; mnDY = 0; @@ -1147,7 +1147,7 @@ void ToolBox::ImplInitToolBoxData() mpStatusListener = new VclStatusListener<ToolBox>(this, ".uno:ImageOrientation"); mpStatusListener->startListening(); - mpIdle = new Idle("vcl::ToolBox maIdle update"); + mpIdle.reset(new Idle("vcl::ToolBox maIdle update")); mpIdle->SetPriority( TaskPriority::RESIZE ); mpIdle->SetInvokeHandler( LINK( this, ToolBox, ImplUpdateHdl ) ); @@ -1355,8 +1355,7 @@ void ToolBox::dispose() mpFloatWin = nullptr; // delete private data - delete mpData; - mpData = nullptr; + mpData.reset(); ImplSVData* pSVData = ImplGetSVData(); delete pSVData->maCtrlData.mpTBDragMgr; @@ -1367,8 +1366,7 @@ void ToolBox::dispose() mpFloatWin.clear(); - delete mpIdle; - mpIdle = nullptr; + mpIdle.reset(); DockingWindow::dispose(); } |