diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-09 09:59:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-14 11:11:42 +0200 |
commit | 89507e35e1bb4ce390d7550d2bb02edcbf74c5e7 (patch) | |
tree | 6eacdadd2698e2c9f0c9bd98ed68b7c388f3996c | |
parent | 5c3816cce5054ef41af441f9a280a8025ff6d691 (diff) |
loplugin:useuniqueptr in MediaFloater
Change-Id: Ibdf838b630fdd63f549b59f69ee05c2030326fa5
Reviewed-on: https://gerrit.libreoffice.org/54175
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | avmedia/source/framework/mediaplayer.cxx | 8 | ||||
-rw-r--r-- | include/avmedia/mediaplayer.hxx | 3 |
2 files changed, 5 insertions, 6 deletions
diff --git a/avmedia/source/framework/mediaplayer.cxx b/avmedia/source/framework/mediaplayer.cxx index dad2b2ddbd24..717f99369e7f 100644 --- a/avmedia/source/framework/mediaplayer.cxx +++ b/avmedia/source/framework/mediaplayer.cxx @@ -74,8 +74,7 @@ void MediaFloater::dispose() Show(false, ShowFlags::NoFocusChange); SetFloatingMode(false); } - delete mpMediaWindow; - mpMediaWindow = nullptr; + mpMediaWindow.reset(); SfxDockingWindow::dispose(); } @@ -93,15 +92,14 @@ void MediaFloater::ToggleFloatingMode() if (mpMediaWindow) mpMediaWindow->updateMediaItem( aRestoreItem ); - delete mpMediaWindow; - mpMediaWindow = nullptr; + mpMediaWindow.reset(); SfxDockingWindow::ToggleFloatingMode(); if (isDisposed()) return; - mpMediaWindow = new MediaWindow( this, true ); + mpMediaWindow.reset( new MediaWindow( this, true ) ); mpMediaWindow->setPosSize( tools::Rectangle( Point(), GetOutputSizePixel() ) ); mpMediaWindow->executeMediaItem( aRestoreItem ); diff --git a/include/avmedia/mediaplayer.hxx b/include/avmedia/mediaplayer.hxx index ac45b92d42ed..12164cdc9308 100644 --- a/include/avmedia/mediaplayer.hxx +++ b/include/avmedia/mediaplayer.hxx @@ -24,6 +24,7 @@ #include <sfx2/dockwin.hxx> #include <sfx2/viewfrm.hxx> #include <avmedia/avmediadllapi.h> +#include <memory> namespace avmedia { @@ -56,7 +57,7 @@ private: virtual void Resize() override; virtual void ToggleFloatingMode() override; - MediaWindow* mpMediaWindow; + std::unique_ptr<MediaWindow> mpMediaWindow; }; inline MediaFloater * getMediaFloater() { |