summaryrefslogtreecommitdiff
path: root/xmlhelp
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-02-21 15:33:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-02-22 06:17:39 +0000
commite171af99c0ed9c0e680c9fb95340f6d8535978e9 (patch)
treeb61a86d518d82cdcb40f775662dc0a696f2a3a85 /xmlhelp
parentc41e872ed248f804249ecf4d65c4afc2e426e329 (diff)
osl::Mutex->std::mutex in ResultSetBase
Change-Id: I6f0afa46ad84782c3f7219bcb1b28d5627063bcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147418 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlhelp')
-rw-r--r--xmlhelp/source/cxxhelp/provider/resultsetbase.cxx58
-rw-r--r--xmlhelp/source/cxxhelp/provider/resultsetbase.hxx11
2 files changed, 26 insertions, 43 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
index 2f64acaac3c1..58d8e70c5b49 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx
@@ -85,13 +85,8 @@ void SAL_CALL
ResultSetBase::addEventListener(
const uno::Reference< lang::XEventListener >& Listener )
{
- osl::MutexGuard aGuard( m_aMutex );
-
- if ( ! m_pDisposeEventListeners )
- m_pDisposeEventListeners.reset(
- new comphelper::OInterfaceContainerHelper3<lang::XEventListener>( m_aMutex ));
-
- m_pDisposeEventListeners->addInterface( Listener );
+ std::unique_lock aGuard( m_aMutex );
+ m_aDisposeEventListeners.addInterface( aGuard, Listener );
}
@@ -99,32 +94,30 @@ void SAL_CALL
ResultSetBase::removeEventListener(
const uno::Reference< lang::XEventListener >& Listener )
{
- osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_pDisposeEventListeners )
- m_pDisposeEventListeners->removeInterface( Listener );
+ std::unique_lock aGuard( m_aMutex );
+ m_aDisposeEventListeners.removeInterface( aGuard, Listener );
}
void SAL_CALL
ResultSetBase::dispose()
{
- osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
lang::EventObject aEvt;
aEvt.Source = static_cast< lang::XComponent * >( this );
- if ( m_pDisposeEventListeners && m_pDisposeEventListeners->getLength() )
+ if ( m_aDisposeEventListeners.getLength(aGuard) )
{
- m_pDisposeEventListeners->disposeAndClear( aEvt );
+ m_aDisposeEventListeners.disposeAndClear( aGuard, aEvt );
}
- if( m_pRowCountListeners && m_pRowCountListeners->getLength() )
+ if( m_aRowCountListeners.getLength(aGuard) )
{
- m_pRowCountListeners->disposeAndClear( aEvt );
+ m_aRowCountListeners.disposeAndClear( aGuard, aEvt );
}
- if( m_pIsFinalListeners && m_pIsFinalListeners->getLength() )
+ if( m_aIsFinalListeners.getLength(aGuard) )
{
- m_pIsFinalListeners->disposeAndClear( aEvt );
+ m_aIsFinalListeners.disposeAndClear( aGuard, aEvt );
}
}
@@ -438,20 +431,13 @@ void SAL_CALL ResultSetBase::addPropertyChangeListener(
{
if( aPropertyName == "IsRowCountFinal" )
{
- osl::MutexGuard aGuard( m_aMutex );
- if ( ! m_pIsFinalListeners )
- m_pIsFinalListeners.reset(
- new comphelper::OInterfaceContainerHelper3<beans::XPropertyChangeListener>( m_aMutex ));
-
- m_pIsFinalListeners->addInterface( xListener );
+ std::unique_lock aGuard( m_aMutex );
+ m_aIsFinalListeners.addInterface( aGuard, xListener );
}
else if ( aPropertyName == "RowCount" )
{
- osl::MutexGuard aGuard( m_aMutex );
- if ( ! m_pRowCountListeners )
- m_pRowCountListeners.reset(
- new comphelper::OInterfaceContainerHelper3<beans::XPropertyChangeListener>( m_aMutex ));
- m_pRowCountListeners->addInterface( xListener );
+ std::unique_lock aGuard( m_aMutex );
+ m_aRowCountListeners.addInterface( aGuard, xListener );
}
else
throw beans::UnknownPropertyException(aPropertyName);
@@ -462,17 +448,15 @@ void SAL_CALL ResultSetBase::removePropertyChangeListener(
const OUString& aPropertyName,
const uno::Reference< beans::XPropertyChangeListener >& aListener )
{
- if( aPropertyName == "IsRowCountFinal" &&
- m_pIsFinalListeners )
+ if( aPropertyName == "IsRowCountFinal" )
{
- osl::MutexGuard aGuard( m_aMutex );
- m_pIsFinalListeners->removeInterface( aListener );
+ std::unique_lock aGuard( m_aMutex );
+ m_aIsFinalListeners.removeInterface( aGuard, aListener );
}
- else if ( aPropertyName == "RowCount" &&
- m_pRowCountListeners )
+ else if ( aPropertyName == "RowCount" )
{
- osl::MutexGuard aGuard( m_aMutex );
- m_pRowCountListeners->removeInterface( aListener );
+ std::unique_lock aGuard( m_aMutex );
+ m_aRowCountListeners.removeInterface( aGuard, aListener );
}
else
throw beans::UnknownPropertyException(aPropertyName);
diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx
index 00581142669e..4327d3e97201 100644
--- a/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx
+++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.hxx
@@ -21,7 +21,7 @@
#include <vector>
#include <memory>
#include <cppuhelper/weak.hxx>
-#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/sdbc/XCloseable.hpp>
@@ -387,11 +387,10 @@ namespace chelp {
css::uno::Sequence< css::beans::Property > m_sProperty;
- osl::Mutex m_aMutex;
- std::unique_ptr<comphelper::OInterfaceContainerHelper3<css::lang::XEventListener>> m_pDisposeEventListeners;
-
- std::unique_ptr<comphelper::OInterfaceContainerHelper3<css::beans::XPropertyChangeListener>> m_pRowCountListeners;
- std::unique_ptr<comphelper::OInterfaceContainerHelper3<css::beans::XPropertyChangeListener>> m_pIsFinalListeners;
+ std::mutex m_aMutex;
+ comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aDisposeEventListeners;
+ comphelper::OInterfaceContainerHelper4<css::beans::XPropertyChangeListener> m_aRowCountListeners;
+ comphelper::OInterfaceContainerHelper4<css::beans::XPropertyChangeListener> m_aIsFinalListeners;
};