summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-01 18:00:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-02 08:27:17 +0200
commitb6025e6cffe2024fefebd161ea739188b4b4fdaf (patch)
tree30aa7eb74852ce982721c52da797cc20717d2c07
parente43764452e3e2a8b0acb197d6eff2cb9fc76772a (diff)
loplugin:useuniqueptr in GalleryTransferable
Change-Id: Iad9ca26bb94fb1d499d3ce028b2289c11c1771fa Reviewed-on: https://gerrit.libreoffice.org/53711 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/svx/galmisc.hxx7
-rw-r--r--svx/source/gallery2/galmisc.cxx15
2 files changed, 10 insertions, 12 deletions
diff --git a/include/svx/galmisc.hxx b/include/svx/galmisc.hxx
index fbc3a4bc9a98..d48f144ec514 100644
--- a/include/svx/galmisc.hxx
+++ b/include/svx/galmisc.hxx
@@ -31,6 +31,7 @@
#include <svx/svxdllapi.h>
#include <tools/date.hxx>
#include <tools/time.hxx>
+#include <memory>
class GalleryTheme;
class SotStorageStream;
@@ -142,9 +143,9 @@ using TransferableHelper::CopyToClipboard;
GalleryTheme* mpTheme;
SgaObjKind meObjectKind;
sal_uInt32 mnObjectPos;
- tools::SvRef<SotStorageStream> mxModelStream;
- GraphicObject* mpGraphicObject;
- INetURLObject* mpURL;
+ tools::SvRef<SotStorageStream> mxModelStream;
+ std::unique_ptr<GraphicObject> mpGraphicObject;
+ std::unique_ptr<INetURLObject> mpURL;
GalleryTransferable( GalleryTheme* pTheme, sal_uInt32 nObjectPos, bool bLazy );
virtual ~GalleryTransferable() override;
diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx
index 5cc0006b9c7e..94abe00ce6b5 100644
--- a/svx/source/gallery2/galmisc.cxx
+++ b/svx/source/gallery2/galmisc.cxx
@@ -403,7 +403,7 @@ void GalleryTransferable::InitData( bool bLazy )
Graphic aGraphic;
if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
- mpGraphicObject = new GraphicObject( aGraphic );
+ mpGraphicObject.reset(new GraphicObject( aGraphic ));
}
if( !mxModelStream.is() )
@@ -427,12 +427,11 @@ void GalleryTransferable::InitData( bool bLazy )
{
if( !mpURL )
{
- mpURL = new INetURLObject;
+ mpURL.reset(new INetURLObject);
if( !mpTheme->GetURL( mnObjectPos, *mpURL ) )
{
- delete mpURL;
- mpURL = nullptr;
+ mpURL.reset();
}
}
@@ -441,7 +440,7 @@ void GalleryTransferable::InitData( bool bLazy )
Graphic aGraphic;
if( mpTheme->GetGraphic( mnObjectPos, aGraphic ) )
- mpGraphicObject = new GraphicObject( aGraphic );
+ mpGraphicObject.reset(new GraphicObject( aGraphic ));
}
}
break;
@@ -544,10 +543,8 @@ void GalleryTransferable::DragFinished( sal_Int8 nDropAction )
void GalleryTransferable::ObjectReleased()
{
mxModelStream.clear();
- delete mpGraphicObject;
- mpGraphicObject = nullptr;
- delete mpURL;
- mpURL = nullptr;
+ mpGraphicObject.reset();
+ mpURL.reset();
}
void GalleryTransferable::StartDrag( vcl::Window* pWindow, sal_Int8 nDragSourceActions )