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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 1 05:46:01 UTC 2018


 ucbhelper/source/provider/contenthelper.cxx |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

New commits:
commit 207d8b88ecf43a945745194dc999348e570a5264
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Oct 29 14:27:32 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 1 06:45:31 2018 +0100

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

diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx
index 4119d91690e5..1482c036b2f1 100644
--- a/ucbhelper/source/provider/contenthelper.cxx
+++ b/ucbhelper/source/provider/contenthelper.cxx
@@ -87,7 +87,7 @@ struct hashPtr
 typedef std::unordered_map
 <
     XPropertiesChangeListenerPtr,
-    PropertyEventSequence*,
+    PropertyEventSequence,
     hashPtr,
     equalPtr
 >
@@ -696,11 +696,10 @@ void ContentImplHelper::notifyPropertiesChange(
                     if ( it == aListeners.end() )
                     {
                         // Not in map - create and insert new entry.
-                        p = new PropertyEventSequence( nCount );
-                        aListeners[ pListener ] = p;
+                        p = &aListeners.emplace( pListener, PropertyEventSequence(nCount)).first->second;
                     }
                     else
-                        p = (*it).second;
+                        p = &it->second;
 
                     if ( p )
                         p->append( rEvent );
@@ -714,15 +713,13 @@ void ContentImplHelper::notifyPropertiesChange(
         {
             beans::XPropertiesChangeListener* pListener =
                 static_cast< beans::XPropertiesChangeListener * >( (*it).first );
-            PropertyEventSequence* pSeq = (*it).second;
+            PropertyEventSequence pSeq = std::move(it->second);
 
             // Remove current element.
             aListeners.erase( it );
 
             // Propagate event.
-            pListener->propertiesChange( pSeq->getEvents() );
-
-            delete pSeq;
+            pListener->propertiesChange( pSeq.getEvents() );
 
             it = aListeners.begin();
         }


More information about the Libreoffice-commits mailing list