summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-09 09:59:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-14 11:11:42 +0200
commit89507e35e1bb4ce390d7550d2bb02edcbf74c5e7 (patch)
tree6eacdadd2698e2c9f0c9bd98ed68b7c388f3996c
parentloplugin:useuniqueptr in SfxTabDialog (diff)
downloadcore-89507e35e1bb4ce390d7550d2bb02edcbf74c5e7.tar.gz
core-89507e35e1bb4ce390d7550d2bb02edcbf74c5e7.zip
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.cxx8
-rw-r--r--include/avmedia/mediaplayer.hxx3
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() {