summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-06-20 15:23:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-21 09:38:50 +0200
commit46d9abb1f1adfd03d18cde11525e92d99206b8c9 (patch)
tree9cdfe9cf77e17de0198b68b65e9145105cd58349 /forms
parent43bc1b5c92b7415ec90eb9807c105508b2e35ccc (diff)
loplugin:useuniqueptr in OClickableImageBaseModel
Change-Id: Ia262bb241d26197f93023f47a7164d0231cc8b70 Reviewed-on: https://gerrit.libreoffice.org/56188 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/clickableimage.cxx17
-rw-r--r--forms/source/component/clickableimage.hxx2
2 files changed, 5 insertions, 14 deletions
diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx
index 7d0b389db85b..b90eaf799208 100644
--- a/forms/source/component/clickableimage.cxx
+++ b/forms/source/component/clickableimage.cxx
@@ -569,12 +569,7 @@ namespace frm
void OClickableImageBaseModel::disposing()
{
OControlModel::disposing();
- if (m_pMedium)
- {
- delete m_pMedium;
- m_pMedium = nullptr;
- }
-
+ m_pMedium.reset();
m_xProducer.clear();
}
@@ -689,8 +684,7 @@ namespace frm
else
{
pImgProd->SetImage(OUString());
- delete m_pMedium;
- m_pMedium = nullptr;
+ m_pMedium.reset();
}
}
@@ -701,8 +695,7 @@ namespace frm
{
// Free the stream at the Producer, before the medium is deleted
GetImageProducer()->SetImage(OUString());
- delete m_pMedium;
- m_pMedium = nullptr;
+ m_pMedium.reset();
}
// the SfxMedium is not allowed to be created with an invalid URL, so we have to check this first
@@ -713,9 +706,7 @@ namespace frm
if (!rURL.isEmpty() && !::svt::GraphicAccess::isSupportedURL( rURL ) )
{
- delete m_pMedium;
-
- m_pMedium = new SfxMedium(rURL, StreamMode::STD_READ);
+ m_pMedium.reset(new SfxMedium(rURL, StreamMode::STD_READ));
// Find the XModel to get to the Object shell or at least the
// Referer.
diff --git a/forms/source/component/clickableimage.hxx b/forms/source/component/clickableimage.hxx
index 1aefca1563e7..346ae094212b 100644
--- a/forms/source/component/clickableimage.hxx
+++ b/forms/source/component/clickableimage.hxx
@@ -66,7 +66,7 @@ namespace frm
// ImageProducer stuff
// Store the image in a graphic object to make it accessible via graphic cache using graphic ID.
css::uno::Reference< css::graphic::XGraphicObject > m_xGraphicObject;
- SfxMedium* m_pMedium; // Download medium
+ std::unique_ptr<SfxMedium> m_pMedium; // Download medium
rtl::Reference<ImageProducer> m_xProducer;
bool m_bDispatchUrlInternal; // property: is not allowed to set : 1
bool m_bProdStarted : 1;