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

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 5 06:27:23 UTC 2018


 xmlhelp/source/cxxhelp/provider/resultsetbase.cxx |   15 ++++++---------
 xmlhelp/source/cxxhelp/provider/resultsetbase.hxx |    7 ++++---
 2 files changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 1fa230f73c907b1003034e17134275595f19f0e6
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Feb 28 10:13:54 2018 +0200

    loplugin:useuniqueptr in chelp::ResultSetBase
    
    Change-Id: I6e8541837a07c8cf2e001289e0804d7e4e7ba3b1
    Reviewed-on: https://gerrit.libreoffice.org/50658
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
index 70fdf9c5e0e5..8d5fb3f3722a 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
@@ -48,9 +48,6 @@ ResultSetBase::ResultSetBase( const uno::Reference< uno::XComponentContext >&  r
 
 ResultSetBase::~ResultSetBase()
 {
-    delete m_pIsFinalListeners;
-    delete m_pRowCountListeners;
-    delete m_pDisposeEventListeners;
 }
 
 
@@ -96,8 +93,8 @@ ResultSetBase::addEventListener(
     osl::MutexGuard aGuard( m_aMutex );
 
     if ( ! m_pDisposeEventListeners )
-        m_pDisposeEventListeners =
-            new comphelper::OInterfaceContainerHelper2( m_aMutex );
+        m_pDisposeEventListeners.reset(
+            new comphelper::OInterfaceContainerHelper2( m_aMutex ));
 
     m_pDisposeEventListeners->addInterface( Listener );
 }
@@ -453,8 +450,8 @@ void SAL_CALL ResultSetBase::addPropertyChangeListener(
     {
         osl::MutexGuard aGuard( m_aMutex );
         if ( ! m_pIsFinalListeners )
-            m_pIsFinalListeners =
-                new comphelper::OInterfaceContainerHelper2( m_aMutex );
+            m_pIsFinalListeners.reset(
+                new comphelper::OInterfaceContainerHelper2( m_aMutex ));
 
         m_pIsFinalListeners->addInterface( xListener );
     }
@@ -462,8 +459,8 @@ void SAL_CALL ResultSetBase::addPropertyChangeListener(
     {
         osl::MutexGuard aGuard( m_aMutex );
         if ( ! m_pRowCountListeners )
-            m_pRowCountListeners =
-                new comphelper::OInterfaceContainerHelper2( m_aMutex );
+            m_pRowCountListeners.reset(
+                new comphelper::OInterfaceContainerHelper2( m_aMutex ));
         m_pRowCountListeners->addInterface( xListener );
     }
     else
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx
index af6d4a6959ce..9c1a016030dd 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_XMLHELP_SOURCE_CXXHELP_PROVIDER_RESULTSETBASE_HXX
 
 #include <vector>
+#include <memory>
 #include <cppuhelper/weak.hxx>
 #include <comphelper/interfacecontainer2.hxx>
 #include <com/sun/star/lang/XComponent.hpp>
@@ -390,10 +391,10 @@ namespace chelp {
         css::uno::Sequence< css::beans::Property >           m_sProperty;
 
         osl::Mutex                          m_aMutex;
-        comphelper::OInterfaceContainerHelper2*   m_pDisposeEventListeners;
+        std::unique_ptr<comphelper::OInterfaceContainerHelper2>   m_pDisposeEventListeners;
 
-        comphelper::OInterfaceContainerHelper2*   m_pRowCountListeners;
-        comphelper::OInterfaceContainerHelper2*   m_pIsFinalListeners;
+        std::unique_ptr<comphelper::OInterfaceContainerHelper2>   m_pRowCountListeners;
+        std::unique_ptr<comphelper::OInterfaceContainerHelper2>   m_pIsFinalListeners;
     };
 
 


More information about the Libreoffice-commits mailing list