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

Noel Grandin noel.grandin at collabora.co.uk
Fri Jan 26 07:12:17 UTC 2018


 ucb/source/sorter/sortresult.cxx |   11 ++++-------
 ucb/source/sorter/sortresult.hxx |    5 +++--
 2 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 47ae2add3a818dff6c85c5a4376772b542258484
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Jan 23 08:56:19 2018 +0200

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

diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx
index 4041fdcb806e..e18360794bf4 100644
--- a/ucb/source/sorter/sortresult.cxx
+++ b/ucb/source/sorter/sortresult.cxx
@@ -141,9 +141,6 @@ SortedResultSet::~SortedResultSet()
     mpSortInfo = nullptr;
 
     mpPropSetInfo.clear();
-
-    delete mpPropChangeListeners;
-    delete mpVetoChangeListeners;
 }
 
 
@@ -823,8 +820,8 @@ void SAL_CALL SortedResultSet::addPropertyChangeListener(
     osl::Guard< osl::Mutex > aGuard( maMutex );
 
     if ( !mpPropChangeListeners )
-        mpPropChangeListeners =
-                    new PropertyChangeListeners_Impl();
+        mpPropChangeListeners.reset(
+                    new PropertyChangeListeners_Impl() );
 
     mpPropChangeListeners->addInterface( PropertyName, Listener );
 }
@@ -848,8 +845,8 @@ void SAL_CALL SortedResultSet::addVetoableChangeListener(
     osl::Guard< osl::Mutex > aGuard( maMutex );
 
     if ( !mpVetoChangeListeners )
-        mpVetoChangeListeners =
-                    new PropertyChangeListeners_Impl();
+        mpVetoChangeListeners.reset(
+                    new PropertyChangeListeners_Impl() );
 
     mpVetoChangeListeners->addInterface( PropertyName, Listener );
 }
diff --git a/ucb/source/sorter/sortresult.hxx b/ucb/source/sorter/sortresult.hxx
index 649a5c957e5d..f97f9050c6bc 100644
--- a/ucb/source/sorter/sortresult.hxx
+++ b/ucb/source/sorter/sortresult.hxx
@@ -37,6 +37,7 @@
 #include <cppuhelper/implbase.hxx>
 #include <rtl/ref.hxx>
 #include <deque>
+#include <memory>
 
 namespace comphelper {
     class OInterfaceContainerHelper2;
@@ -99,8 +100,8 @@ class SortedResultSet: public cppu::WeakImplHelper <
     css::beans::XPropertySet >
 {
     comphelper::OInterfaceContainerHelper2 *mpDisposeEventListeners;
-    PropertyChangeListeners_Impl    *mpPropChangeListeners;
-    PropertyChangeListeners_Impl    *mpVetoChangeListeners;
+    std::unique_ptr<PropertyChangeListeners_Impl>    mpPropChangeListeners;
+    std::unique_ptr<PropertyChangeListeners_Impl>    mpVetoChangeListeners;
 
     css::uno::Reference < css::sdbc::XResultSet >            mxOriginal;
     css::uno::Reference < css::sdbc::XResultSet >            mxOther;


More information about the Libreoffice-commits mailing list