summaryrefslogtreecommitdiff
path: root/scripting/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-11-28 09:58:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-11-28 17:21:22 +0100
commit9622b62f1bc181f3841f0e730fb212bfd40758b8 (patch)
tree930e3c85996894b6451c57e3ccf44ad536bff84b /scripting/source
parentd9bda6f84c5f8c0f87545de22014ee64fbdf0c2f (diff)
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.grandin@collabora.co.uk>
Diffstat (limited to 'scripting/source')
-rw-r--r--scripting/source/stringresource/stringresource.cxx12
-rw-r--r--scripting/source/stringresource/stringresource.hxx4
2 files changed, 6 insertions, 10 deletions
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;