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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 10 15:12:34 UTC 2021


 extensions/source/propctrlr/eformshelper.cxx    |   12 ++++++------
 extensions/source/propctrlr/propertyhandler.cxx |   12 ++++++------
 include/comphelper/listenernotification.hxx     |    5 ++---
 3 files changed, 14 insertions(+), 15 deletions(-)

New commits:
commit c23730471c487b8f01eddfa3845b49316c0db94d
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Aug 9 17:52:30 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 10 17:11:55 2021 +0200

    can return OInterfaceIteratorHelper2 by value here
    
    Change-Id: I32e94473667a734e582dad0a9785c8e9cfbc8cff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120213
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx
index 94f8e7a4b969..36f5f2a2b44d 100644
--- a/extensions/source/propctrlr/eformshelper.cxx
+++ b/extensions/source/propctrlr/eformshelper.cxx
@@ -241,10 +241,10 @@ namespace pcr
     {
         if ( !_bDoListen )
         {
-            std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > pListenerIterator = m_aPropertyListeners.createIterator();
-            while ( pListenerIterator->hasMoreElements() )
+            ::comphelper::OInterfaceIteratorHelper2 aListenerIterator = m_aPropertyListeners.createIterator();
+            while ( aListenerIterator.hasMoreElements() )
             {
-                PropertyEventTranslation* pTranslator = dynamic_cast< PropertyEventTranslation* >( pListenerIterator->next() );
+                PropertyEventTranslation* pTranslator = dynamic_cast< PropertyEventTranslation* >( aListenerIterator.next() );
                 OSL_ENSURE( pTranslator, "EFormsHelper::impl_toggleBindingPropertyListening_throw: invalid listener element in my container!" );
                 if ( !pTranslator )
                     continue;
@@ -275,10 +275,10 @@ namespace pcr
             }
             else
             {
-                std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > pListenerIterator = m_aPropertyListeners.createIterator();
-                while ( pListenerIterator->hasMoreElements() )
+                ::comphelper::OInterfaceIteratorHelper2 aListenerIterator = m_aPropertyListeners.createIterator();
+                while ( aListenerIterator.hasMoreElements() )
                 {
-                    Reference< XPropertyChangeListener > xListener( pListenerIterator->next(), UNO_QUERY );
+                    Reference< XPropertyChangeListener > xListener( aListenerIterator.next(), UNO_QUERY );
                     impl_switchBindingListening_throw( true, xListener );
                 }
             }
diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx
index c47f4e822228..a1817393324f 100644
--- a/extensions/source/propctrlr/propertyhandler.cxx
+++ b/extensions/source/propctrlr/propertyhandler.cxx
@@ -79,10 +79,10 @@ namespace pcr
             return;
 
         // remove all old property change listeners
-        std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > removeListener = m_aPropertyListeners.createIterator();
-        std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > readdListener = m_aPropertyListeners.createIterator();  // will copy the container as needed
-        while ( removeListener->hasMoreElements() )
-            removePropertyChangeListener( static_cast< XPropertyChangeListener* >( removeListener->next() ) );
+        ::comphelper::OInterfaceIteratorHelper2 removeListener = m_aPropertyListeners.createIterator();
+        ::comphelper::OInterfaceIteratorHelper2 readdListener = m_aPropertyListeners.createIterator();  // will copy the container as needed
+        while ( removeListener.hasMoreElements() )
+            removePropertyChangeListener( static_cast< XPropertyChangeListener* >( removeListener.next() ) );
         OSL_ENSURE( m_aPropertyListeners.empty(), "PropertyHandler::inspect: derived classes are expected to forward the removePropertyChangeListener call to their base class (me)!" );
 
         // remember the new component, and give derived classes the chance to react on it
@@ -90,8 +90,8 @@ namespace pcr
         onNewComponent();
 
         // add the listeners, again
-        while ( readdListener->hasMoreElements() )
-            addPropertyChangeListener( static_cast< XPropertyChangeListener* >( readdListener->next() ) );
+        while ( readdListener.hasMoreElements() )
+            addPropertyChangeListener( static_cast< XPropertyChangeListener* >( readdListener.next() ) );
     }
 
     void PropertyHandler::onNewComponent()
diff --git a/include/comphelper/listenernotification.hxx b/include/comphelper/listenernotification.hxx
index 688571304938..15f1ca64b980 100644
--- a/include/comphelper/listenernotification.hxx
+++ b/include/comphelper/listenernotification.hxx
@@ -79,10 +79,9 @@ namespace comphelper
 
         /** creates an iterator for looping through all registered listeners
         */
-        ::std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > createIterator()
+        ::comphelper::OInterfaceIteratorHelper2 createIterator()
         {
-            ::std::unique_ptr< ::comphelper::OInterfaceIteratorHelper2 > pIterator( new ::comphelper::OInterfaceIteratorHelper2( m_aListeners ) );
-            return pIterator;
+            return ::comphelper::OInterfaceIteratorHelper2( m_aListeners );
         }
 
     protected:


More information about the Libreoffice-commits mailing list