forms/source/component/clickableimage.cxx | 17 ++++------------- forms/source/component/clickableimage.hxx | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-)
New commits: commit 46d9abb1f1adfd03d18cde11525e92d99206b8c9 Author: Noel Grandin <[email protected]> Date: Wed Jun 20 15:23:10 2018 +0200 loplugin:useuniqueptr in OClickableImageBaseModel Change-Id: Ia262bb241d26197f93023f47a7164d0231cc8b70 Reviewed-on: https://gerrit.libreoffice.org/56188 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> 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; _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
