summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-20 17:10:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-23 08:16:04 +0200
commit7c08c1af7116346f2dc0b669e231d82f4230a8c7 (patch)
tree5ff4ff717ac187f29d183d8ddc4d63b2bc81ba0f
parente098e2d5bf0f0f9452774c133cca23ba7fbd16df (diff)
loplugin:useuniqueptr in MenuButton
Change-Id: I4e7a2ca5f8bb645e99414b1c99dc6261310c89bb Reviewed-on: https://gerrit.libreoffice.org/53237 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/vcl/menubtn.hxx3
-rw-r--r--vcl/source/control/menubtn.cxx4
2 files changed, 4 insertions, 3 deletions
diff --git a/include/vcl/menubtn.hxx b/include/vcl/menubtn.hxx
index dfbb39962139..99ddf2bdb1e2 100644
--- a/include/vcl/menubtn.hxx
+++ b/include/vcl/menubtn.hxx
@@ -22,6 +22,7 @@
#include <vcl/button.hxx>
#include <vcl/dllapi.h>
+#include <memory>
class FloatingWindow;
class Timer;
@@ -34,7 +35,7 @@ class VCL_DLLPUBLIC MenuButton : public PushButton
private:
friend class VclBuilder;
- Timer* mpMenuTimer;
+ std::unique_ptr<Timer> mpMenuTimer;
VclPtr<PopupMenu> mpMenu;
VclPtr<Window> mpFloatingWindow;
sal_uInt16 mnCurItemId;
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index 5771f24ab289..0b47bf8dfac8 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -96,7 +96,7 @@ MenuButton::~MenuButton()
void MenuButton::dispose()
{
- delete mpMenuTimer;
+ mpMenuTimer.reset();
mpFloatingWindow.clear();
mpMenu.clear();
PushButton::dispose();
@@ -124,7 +124,7 @@ void MenuButton::MouseButtonDown( const MouseEvent& rMEvt )
{
if ( !mpMenuTimer )
{
- mpMenuTimer = new Timer("MenuTimer");
+ mpMenuTimer.reset(new Timer("MenuTimer"));
mpMenuTimer->SetInvokeHandler( LINK( this, MenuButton, ImplMenuTimeoutHdl ) );
}