scripting/source/stringresource/stringresource.cxx |   12 ++++--------
 scripting/source/stringresource/stringresource.hxx |    4 ++--
 2 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit 9622b62f1bc181f3841f0e730fb212bfd40758b8
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Nov 28 09:58:31 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun Nov 28 17:21:22 2021 +0100

    use more OInterfaceContainerHelper2 in scripting
    
    and remove unnecessary guards, OInterfaceContainerHelper3 will
    already take the mutex
    
    Change-Id: I951d9e02582768c5da9a7a3cc8412381f9f7e9fe
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125970
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/scripting/source/stringresource/stringresource.cxx 
b/scripting/source/stringresource/stringresource.cxx
index 74d491704fcd..c7b40bb09e46 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -115,8 +115,7 @@ void StringResourceImpl::addModifyListener( const 
Reference< XModifyListener >&
     if( !aListener.is() )
         throw RuntimeException();
 
-    ::osl::MutexGuard aGuard( getMutex() );
-    m_aListenerContainer.addInterface( Reference<XInterface>( aListener, 
UNO_QUERY ) );
+    m_aListenerContainer.addInterface( aListener );
 }
 
 void StringResourceImpl::removeModifyListener( const Reference< 
XModifyListener >& aListener )
@@ -124,8 +123,7 @@ void StringResourceImpl::removeModifyListener( const 
Reference< XModifyListener
     if( !aListener.is() )
         throw RuntimeException();
 
-    ::osl::MutexGuard aGuard( getMutex() );
-    m_aListenerContainer.removeInterface( Reference<XInterface>( aListener, 
UNO_QUERY ) );
+    m_aListenerContainer.removeInterface( aListener );
 }
 
 
@@ -615,14 +613,12 @@ void StringResourceImpl::implNotifyListeners()
     EventObject aEvent;
     aEvent.Source = static_cast< XInterface* >( 
static_cast<OWeakObject*>(this) );
 
-    ::comphelper::OInterfaceIteratorHelper2 it( m_aListenerContainer );
+    ::comphelper::OInterfaceIteratorHelper3 it( m_aListenerContainer );
     while( it.hasMoreElements() )
     {
-        Reference< XInterface > xIface = it.next();
-        Reference< XModifyListener > xListener( xIface, UNO_QUERY );
         try
         {
-            xListener->modified( aEvent );
+            it.next()->modified( aEvent );
         }
         catch(RuntimeException&)
         {
diff --git a/scripting/source/stringresource/stringresource.hxx 
b/scripting/source/stringresource/stringresource.hxx
index 2cb2e0aa1424..b2ca571844d3 100644
--- a/scripting/source/stringresource/stringresource.hxx
+++ b/scripting/source/stringresource/stringresource.hxx
@@ -28,7 +28,7 @@
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/io/XOutputStream.hpp>
 #include <cppuhelper/implbase.hxx>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
 #include <osl/mutex.hxx>
 
 #include <unordered_map>
@@ -94,7 +94,7 @@ protected:
     LocaleItem*                                               
m_pDefaultLocaleItem;
     bool                                                      
m_bDefaultModified;
 
-    ::comphelper::OInterfaceContainerHelper2                        
m_aListenerContainer;
+    ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> 
m_aListenerContainer;
 
     std::vector< std::unique_ptr<LocaleItem> >                
m_aLocaleItemVector;
     std::vector< std::unique_ptr<LocaleItem> >                
m_aDeletedLocaleItemVector;

Reply via email to