[Libreoffice-commits] core.git: embeddedobj/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 16 13:27:46 UTC 2017


 embeddedobj/source/general/intercept.cxx |   10 +++-------
 embeddedobj/source/inc/intercept.hxx     |    3 ++-
 2 files changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 53f21cde330de4f0ad054a106e7a15654d79b7ee
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jan 16 09:57:51 2017 +0200

    new loplugin: useuniqueptr: embeddedobj
    
    Change-Id: I4c1302061a3607540af7de7a45ba060d3c0b403b
    Reviewed-on: https://gerrit.libreoffice.org/33153
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/embeddedobj/source/general/intercept.cxx b/embeddedobj/source/general/intercept.cxx
index 96e3595..982ae51 100644
--- a/embeddedobj/source/general/intercept.cxx
+++ b/embeddedobj/source/general/intercept.cxx
@@ -61,7 +61,6 @@ Interceptor::Interceptor( DocumentHolder* pDocHolder )
 
 Interceptor::~Interceptor()
 {
-    delete m_pStatCL;
 }
 
 //XDispatch
@@ -143,8 +142,7 @@ Interceptor::addStatusListener(
         {
             osl::MutexGuard aGuard(m_aMutex);
             if(!m_pStatCL)
-                m_pStatCL =
-                    new StatusChangeListenerContainer(m_aMutex);
+                m_pStatCL.reset(new StatusChangeListenerContainer(m_aMutex));
         }
 
         m_pStatCL->addInterface(URL.Complete,Control);
@@ -168,8 +166,7 @@ Interceptor::addStatusListener(
         {
             osl::MutexGuard aGuard(m_aMutex);
             if(!m_pStatCL)
-                m_pStatCL =
-                    new StatusChangeListenerContainer(m_aMutex);
+                m_pStatCL.reset(new StatusChangeListenerContainer(m_aMutex));
         }
 
         m_pStatCL->addInterface(URL.Complete,Control);
@@ -189,8 +186,7 @@ Interceptor::addStatusListener(
         {
             osl::MutexGuard aGuard(m_aMutex);
             if(!m_pStatCL)
-                m_pStatCL =
-                    new StatusChangeListenerContainer(m_aMutex);
+                m_pStatCL.reset(new StatusChangeListenerContainer(m_aMutex));
         }
 
         m_pStatCL->addInterface(URL.Complete,Control);
diff --git a/embeddedobj/source/inc/intercept.hxx b/embeddedobj/source/inc/intercept.hxx
index 35ad43f..0eee717 100644
--- a/embeddedobj/source/inc/intercept.hxx
+++ b/embeddedobj/source/inc/intercept.hxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
 #include <com/sun/star/frame/XInterceptorInfo.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
+#include <memory>
 
 
 class StatusChangeListenerContainer;
@@ -140,7 +141,7 @@ private:
 
     static css::uno::Sequence< OUString > m_aInterceptedURL;
 
-    StatusChangeListenerContainer*    m_pStatCL;
+    std::unique_ptr<StatusChangeListenerContainer>    m_pStatCL;
 };
 
 #endif


More information about the Libreoffice-commits mailing list