diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-08-09 17:52:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-10 17:11:55 +0200 |
commit | c23730471c487b8f01eddfa3845b49316c0db94d (patch) | |
tree | 0f5ad706784625682abd8bb5f8d3947a0cc23c67 | |
parent | 45aaabbdfb7968d222d88b1b56788c0bd4c5b27d (diff) |
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@collabora.co.uk>
-rw-r--r-- | extensions/source/propctrlr/eformshelper.cxx | 12 | ||||
-rw-r--r-- | extensions/source/propctrlr/propertyhandler.cxx | 12 | ||||
-rw-r--r-- | include/comphelper/listenernotification.hxx | 5 |
3 files changed, 14 insertions, 15 deletions
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: |