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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 5 09:01:27 UTC 2018


 comphelper/source/misc/accessibleeventnotifier.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 2e8944702eb7b1b32392181064a04cd5ae442baf
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Sep 4 11:53:17 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 5 11:01:03 2018 +0200

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

diff --git a/comphelper/source/misc/accessibleeventnotifier.cxx b/comphelper/source/misc/accessibleeventnotifier.cxx
index 34c82c6e74c3..e3f5a3e9d443 100644
--- a/comphelper/source/misc/accessibleeventnotifier.cxx
+++ b/comphelper/source/misc/accessibleeventnotifier.cxx
@@ -22,6 +22,7 @@
 #include <comphelper/interfacecontainer2.hxx>
 
 #include <map>
+#include <memory>
 #include <limits>
 
 using namespace ::com::sun::star::uno;
@@ -180,7 +181,7 @@ void AccessibleEventNotifier::revokeClient( const TClientId _nClient )
 void AccessibleEventNotifier::revokeClientNotifyDisposing(
     const TClientId _nClient, const Reference< XInterface >& _rxEventSource )
 {
-    ::comphelper::OInterfaceContainerHelper2* pListeners(nullptr);
+    std::unique_ptr<::comphelper::OInterfaceContainerHelper2> pListeners;
 
     {
         // rhbz#1001768 drop the mutex before calling disposeAndClear
@@ -192,7 +193,7 @@ void AccessibleEventNotifier::revokeClientNotifyDisposing(
             return;
 
         // notify the listeners
-        pListeners = aClientPos->second;
+        pListeners.reset(aClientPos->second);
 
         // we do not need the entry in the clients map anymore
         // (do this before actually notifying, because some client
@@ -208,7 +209,6 @@ void AccessibleEventNotifier::revokeClientNotifyDisposing(
 
     // now really do the notification
     pListeners->disposeAndClear( aDisposalEvent );
-    delete pListeners;
 }
 
 sal_Int32 AccessibleEventNotifier::addEventListener(


More information about the Libreoffice-commits mailing list