summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/source/ui/browser/sbagrid.cxx37
-rw-r--r--dbaccess/source/ui/inc/sbagrid.hxx6
-rw-r--r--include/svx/fmgridif.hxx14
-rw-r--r--svx/source/fmcomp/fmgridif.cxx69
4 files changed, 72 insertions, 54 deletions
diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx
index 03b81526a372..99ee5c30eb73 100644
--- a/dbaccess/source/ui/browser/sbagrid.cxx
+++ b/dbaccess/source/ui/browser/sbagrid.cxx
@@ -237,7 +237,6 @@ void SAL_CALL SbaXGridControl::dispose()
// SbaXGridPeer
SbaXGridPeer::SbaXGridPeer(const Reference< XComponentContext >& _rM)
: FmXGridPeer(_rM)
-,m_aStatusListeners(m_aMutex)
{
}
@@ -247,10 +246,11 @@ SbaXGridPeer::~SbaXGridPeer()
void SAL_CALL SbaXGridPeer::dispose()
{
- EventObject aEvt(*this);
-
- m_aStatusListeners.disposeAndClear(aEvt);
-
+ {
+ std::unique_lock g(m_aMutex);
+ EventObject aEvt(*this);
+ m_aStatusListeners.disposeAndClear(g, aEvt);
+ }
FmXGridPeer::dispose();
}
@@ -275,12 +275,13 @@ void SbaXGridPeer::NotifyStatusChanged(const css::util::URL& _rUrl, const Refere
xControl->statusChanged(aEvt);
else
{
- ::comphelper::OInterfaceContainerHelper3<css::frame::XStatusListener> * pIter
- = m_aStatusListeners.getContainer(_rUrl);
+ std::unique_lock g(m_aMutex);
+ ::comphelper::OInterfaceContainerHelper4<css::frame::XStatusListener> * pIter
+ = m_aStatusListeners.getContainer(g, _rUrl);
if (pIter)
{
- pIter->notifyEach( &XStatusListener::statusChanged, aEvt );
+ pIter->notifyEach( g, &XStatusListener::statusChanged, aEvt );
}
}
}
@@ -439,20 +440,24 @@ void SAL_CALL SbaXGridPeer::dispatch(const URL& aURL, const Sequence< PropertyVa
void SAL_CALL SbaXGridPeer::addStatusListener(const Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL)
{
- ::comphelper::OInterfaceContainerHelper3< css::frame::XStatusListener >* pCont
- = m_aStatusListeners.getContainer(aURL);
- if (!pCont)
- m_aStatusListeners.addInterface(aURL,xControl);
- else
- pCont->addInterface(xControl);
+ {
+ std::unique_lock g(m_aMutex);
+ ::comphelper::OInterfaceContainerHelper4< css::frame::XStatusListener >* pCont
+ = m_aStatusListeners.getContainer(g, aURL);
+ if (!pCont)
+ m_aStatusListeners.addInterface(g, aURL,xControl);
+ else
+ pCont->addInterface(g, xControl);
+ }
NotifyStatusChanged(aURL, xControl);
}
void SAL_CALL SbaXGridPeer::removeStatusListener(const Reference< css::frame::XStatusListener > & xControl, const css::util::URL& aURL)
{
- ::comphelper::OInterfaceContainerHelper3< css::frame::XStatusListener >* pCont = m_aStatusListeners.getContainer(aURL);
+ std::unique_lock g(m_aMutex);
+ ::comphelper::OInterfaceContainerHelper4< css::frame::XStatusListener >* pCont = m_aStatusListeners.getContainer(g, aURL);
if ( pCont )
- pCont->removeInterface(xControl);
+ pCont->removeInterface(g, xControl);
}
Sequence< Type > SAL_CALL SbaXGridPeer::getTypes()
diff --git a/dbaccess/source/ui/inc/sbagrid.hxx b/dbaccess/source/ui/inc/sbagrid.hxx
index 22af70834425..4c0f37654647 100644
--- a/dbaccess/source/ui/inc/sbagrid.hxx
+++ b/dbaccess/source/ui/inc/sbagrid.hxx
@@ -25,7 +25,7 @@
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/util/URL.hpp>
-#include <comphelper/multiinterfacecontainer3.hxx>
+#include <comphelper/multiinterfacecontainer4.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/uno3.hxx>
#include "sbamultiplex.hxx"
@@ -93,8 +93,8 @@ namespace dbaui
:public FmXGridPeer
,public css::frame::XDispatch
{
- comphelper::OMultiTypeInterfaceContainerHelperVar3< css::frame::XStatusListener,
- css::util::URL, SbaURLCompare> m_aStatusListeners;
+ comphelper::OMultiTypeInterfaceContainerHelperVar4< css::util::URL, css::frame::XStatusListener,
+ SbaURLCompare> m_aStatusListeners;
public:
SbaXGridPeer(const css::uno::Reference< css::uno::XComponentContext >&);
diff --git a/include/svx/fmgridif.hxx b/include/svx/fmgridif.hxx
index e3cce3952b3a..f978b70b546e 100644
--- a/include/svx/fmgridif.hxx
+++ b/include/svx/fmgridif.hxx
@@ -44,7 +44,7 @@
#include <vcl/wintypes.hxx>
#include <toolkit/controls/unocontrol.hxx>
#include <toolkit/awt/vclxwindow.hxx>
-#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <comphelper/servicehelper.hxx>
#include <comphelper/uno3.hxx>
#include <cppuhelper/implbase.hxx>
@@ -342,16 +342,16 @@ class SAL_WARN_UNUSED SVXCORE_DLLPUBLIC FmXGridPeer:
{
protected:
css::uno::Reference< css::uno::XComponentContext > m_xContext;
- ::osl::Mutex m_aMutex;
+ std::mutex m_aMutex;
private:
css::uno::Reference< css::container::XIndexContainer > m_xColumns;
css::uno::Reference< css::sdbc::XRowSet > m_xCursor;
- ::comphelper::OInterfaceContainerHelper3<css::util::XModifyListener> m_aModifyListeners;
- ::comphelper::OInterfaceContainerHelper3<css::form::XUpdateListener> m_aUpdateListeners;
- ::comphelper::OInterfaceContainerHelper3<css::container::XContainerListener> m_aContainerListeners;
- ::comphelper::OInterfaceContainerHelper3<css::view::XSelectionChangeListener> m_aSelectionListeners;
- ::comphelper::OInterfaceContainerHelper3<css::form::XGridControlListener> m_aGridControlListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::util::XModifyListener> m_aModifyListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::form::XUpdateListener> m_aUpdateListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::container::XContainerListener> m_aContainerListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::view::XSelectionChangeListener> m_aSelectionListeners;
+ ::comphelper::OInterfaceContainerHelper4<css::form::XGridControlListener> m_aGridControlListeners;
OUString m_aMode;
sal_Int32 m_nCursorListening;
diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 05ccd00c75c9..f78f6bb2100f 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -1020,26 +1020,23 @@ void FmXGridPeer::GridListenerDelegator::columnChanged()
void FmXGridPeer::selectionChanged()
{
+ std::unique_lock g(m_aMutex);
EventObject aSource;
aSource.Source = static_cast< ::cppu::OWeakObject* >(this);
- m_aSelectionListeners.notifyEach( &XSelectionChangeListener::selectionChanged, aSource);
+ m_aSelectionListeners.notifyEach( g, &XSelectionChangeListener::selectionChanged, aSource);
}
void FmXGridPeer::columnChanged()
{
+ std::unique_lock g(m_aMutex);
EventObject aEvent( *this );
- m_aGridControlListeners.notifyEach( &XGridControlListener::columnChanged, aEvent );
+ m_aGridControlListeners.notifyEach( g, &XGridControlListener::columnChanged, aEvent );
}
FmXGridPeer::FmXGridPeer(const Reference< XComponentContext >& _rxContext)
:m_xContext(_rxContext)
- ,m_aModifyListeners(m_aMutex)
- ,m_aUpdateListeners(m_aMutex)
- ,m_aContainerListeners(m_aMutex)
- ,m_aSelectionListeners(m_aMutex)
- ,m_aGridControlListeners(m_aMutex)
,m_aMode("DataMode")
,m_nCursorListening(0)
,m_bInterceptingDispatch(false)
@@ -1124,13 +1121,15 @@ void FmXGridPeer::disposing(const EventObject& e)
void FmXGridPeer::addModifyListener(const Reference< css::util::XModifyListener >& l)
{
- m_aModifyListeners.addInterface( l );
+ std::unique_lock g(m_aMutex);
+ m_aModifyListeners.addInterface( g, l );
}
void FmXGridPeer::removeModifyListener(const Reference< css::util::XModifyListener >& l)
{
- m_aModifyListeners.removeInterface( l );
+ std::unique_lock g(m_aMutex);
+ m_aModifyListeners.removeInterface( g, l );
}
@@ -1312,9 +1311,10 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type
void FmXGridPeer::CellModified()
{
+ std::unique_lock g(m_aMutex);
EventObject aEvt;
aEvt.Source = static_cast< ::cppu::OWeakObject* >(this);
- m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvt );
+ m_aModifyListeners.notifyEach( g, &XModifyListener::modified, aEvt );
}
// XPropertyChangeListener
@@ -1433,13 +1433,15 @@ void FmXGridPeer::propertyChange(const PropertyChangeEvent& evt)
void FmXGridPeer::addUpdateListener(const Reference< XUpdateListener >& l)
{
- m_aUpdateListeners.addInterface(l);
+ std::unique_lock g(m_aMutex);
+ m_aUpdateListeners.addInterface(g, l);
}
void FmXGridPeer::removeUpdateListener(const Reference< XUpdateListener >& l)
{
- m_aUpdateListeners.removeInterface(l);
+ std::unique_lock g(m_aMutex);
+ m_aUpdateListeners.removeInterface(g, l);
}
@@ -1449,8 +1451,9 @@ sal_Bool FmXGridPeer::commit()
if (!m_xCursor.is() || !pGrid)
return true;
+ std::unique_lock g(m_aMutex);
EventObject aEvt(static_cast< ::cppu::OWeakObject* >(this));
- ::comphelper::OInterfaceIteratorHelper3 aIter(m_aUpdateListeners);
+ ::comphelper::OInterfaceIteratorHelper4 aIter(g, m_aUpdateListeners);
bool bCancel = false;
while (aIter.hasMoreElements() && !bCancel)
if ( !aIter.next()->approveUpdate( aEvt ) )
@@ -1460,7 +1463,7 @@ sal_Bool FmXGridPeer::commit()
bCancel = !pGrid->commit();
if (!bCancel)
- m_aUpdateListeners.notifyEach( &XUpdateListener::updated, aEvt );
+ m_aUpdateListeners.notifyEach( g, &XUpdateListener::updated, aEvt );
return !bCancel;
}
@@ -2036,12 +2039,14 @@ Any FmXGridPeer::getProperty( const OUString& _rPropertyName )
void FmXGridPeer::dispose()
{
- EventObject aEvt;
- aEvt.Source = static_cast< ::cppu::OWeakObject* >(this);
- m_aModifyListeners.disposeAndClear(aEvt);
- m_aUpdateListeners.disposeAndClear(aEvt);
- m_aContainerListeners.disposeAndClear(aEvt);
-
+ {
+ std::unique_lock g(m_aMutex);
+ EventObject aEvt;
+ aEvt.Source = static_cast< ::cppu::OWeakObject* >(this);
+ m_aModifyListeners.disposeAndClear(g, aEvt);
+ m_aUpdateListeners.disposeAndClear(g, aEvt);
+ m_aContainerListeners.disposeAndClear(g, aEvt);
+ }
// release all interceptors
Reference< XDispatchProviderInterceptor > xInterceptor( m_xFirstDispatchInterceptor );
m_xFirstDispatchInterceptor.clear();
@@ -2095,12 +2100,14 @@ void FmXGridPeer::dispose()
void FmXGridPeer::addContainerListener(const Reference< XContainerListener >& l)
{
- m_aContainerListeners.addInterface( l );
+ std::unique_lock g(m_aMutex);
+ m_aContainerListeners.addInterface( g, l );
}
void FmXGridPeer::removeContainerListener(const Reference< XContainerListener >& l)
{
- m_aContainerListeners.removeInterface( l );
+ std::unique_lock g(m_aMutex);
+ m_aContainerListeners.removeInterface( g, l );
}
// css::data::XDatabaseCursorSupplier
@@ -2202,13 +2209,15 @@ void FmXGridPeer::setRowSet(const Reference< XRowSet >& _rDatabaseCursor)
void SAL_CALL FmXGridPeer::addGridControlListener( const Reference< XGridControlListener >& _listener )
{
- m_aGridControlListeners.addInterface( _listener );
+ std::unique_lock g(m_aMutex);
+ m_aGridControlListeners.addInterface( g, _listener );
}
void SAL_CALL FmXGridPeer::removeGridControlListener( const Reference< XGridControlListener >& _listener )
{
- m_aGridControlListeners.removeInterface( _listener );
+ std::unique_lock g(m_aMutex);
+ m_aGridControlListeners.removeInterface( g, _listener );
}
@@ -2387,7 +2396,8 @@ void FmXGridPeer::columnVisible(DbGridColumn const * pColumn)
aEvt.Accessor <<= _nIndex;
aEvt.Element <<= xControl;
- m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, aEvt );
+ std::unique_lock g(m_aMutex);
+ m_aContainerListeners.notifyEach( g, &XContainerListener::elementInserted, aEvt );
}
@@ -2402,7 +2412,8 @@ void FmXGridPeer::columnHidden(DbGridColumn const * pColumn)
aEvt.Accessor <<= _nIndex;
aEvt.Element <<= xControl;
- m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, aEvt );
+ std::unique_lock g(m_aMutex);
+ m_aContainerListeners.notifyEach( g, &XContainerListener::elementRemoved, aEvt );
}
@@ -2586,13 +2597,15 @@ Any SAL_CALL FmXGridPeer::getSelection( )
void SAL_CALL FmXGridPeer::addSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener )
{
- m_aSelectionListeners.addInterface( _rxListener );
+ std::unique_lock g(m_aMutex);
+ m_aSelectionListeners.addInterface( g, _rxListener );
}
void SAL_CALL FmXGridPeer::removeSelectionChangeListener( const Reference< XSelectionChangeListener >& _rxListener )
{
- m_aSelectionListeners.removeInterface( _rxListener );
+ std::unique_lock g(m_aMutex);
+ m_aSelectionListeners.removeInterface( g, _rxListener );
}