summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-11-19 20:12:23 +0100
committerMichael Stahl <mstahl@redhat.com>2013-11-20 01:33:42 +0100
commit3e1c7d12eeefdfc50b842fe34f3db657292359b9 (patch)
treeede628029df8a2a9aba9eece4f6876a6ffc2b371
parented750424f7c02b0ae868f33731f90885a4946f47 (diff)
winaccessibility: replace mysterious and inexplicable locking strategy
Do the conservative thing and lock the SolarMutex at every UNO API entry point. Change-Id: I51afffada975df7ee3435784aa050a2c19cd0ac8
-rw-r--r--winaccessibility/inc/AccEventListener.hxx1
-rw-r--r--winaccessibility/inc/AccObjectWinManager.hxx3
-rw-r--r--winaccessibility/source/service/AccComponentEventListener.cxx4
-rw-r--r--winaccessibility/source/service/AccContainerEventListener.cxx4
-rw-r--r--winaccessibility/source/service/AccDescendantManagerEventListener.cxx4
-rw-r--r--winaccessibility/source/service/AccDialogEventListener.cxx4
-rw-r--r--winaccessibility/source/service/AccEventListener.cxx7
-rw-r--r--winaccessibility/source/service/AccFrameEventListener.cxx4
-rw-r--r--winaccessibility/source/service/AccListEventListener.cxx4
-rw-r--r--winaccessibility/source/service/AccMenuEventListener.cxx4
-rw-r--r--winaccessibility/source/service/AccObjectWinManager.cxx7
-rw-r--r--winaccessibility/source/service/AccParagraphEventListener.cxx4
-rw-r--r--winaccessibility/source/service/AccTableEventListener.cxx4
-rw-r--r--winaccessibility/source/service/AccTextComponentEventListener.cxx2
-rw-r--r--winaccessibility/source/service/AccTopWindowListener.cxx3
-rw-r--r--winaccessibility/source/service/AccTreeEventListener.cxx4
-rw-r--r--winaccessibility/source/service/AccWindowEventListener.cxx4
-rw-r--r--winaccessibility/source/service/checkmt.cxx5
-rw-r--r--winaccessibility/source/service/checkmt.hxx2
-rw-r--r--winaccessibility/source/service/msaaservice_impl.cxx6
20 files changed, 63 insertions, 17 deletions
diff --git a/winaccessibility/inc/AccEventListener.hxx b/winaccessibility/inc/AccEventListener.hxx
index ec90022a63fa..a32ab4624efb 100644
--- a/winaccessibility/inc/AccEventListener.hxx
+++ b/winaccessibility/inc/AccEventListener.hxx
@@ -45,7 +45,6 @@ protected:
AccObjectManagerAgent* pAgent;
//disposed state indicator
bool m_isDisposed;
- mutable ::osl::Mutex aRemoveMutex;
public:
AccEventListener( com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
virtual ~AccEventListener();
diff --git a/winaccessibility/inc/AccObjectWinManager.hxx b/winaccessibility/inc/AccObjectWinManager.hxx
index 6d43fdd27e35..046e83e9cd23 100644
--- a/winaccessibility/inc/AccObjectWinManager.hxx
+++ b/winaccessibility/inc/AccObjectWinManager.hxx
@@ -72,9 +72,6 @@ private:
AccObjectManagerAgent* pAgent;
static AccObjectWinManager* me;
ResIDGenerator ResIdGen;
- mutable ::osl::Mutex aDeleteMutex;
- mutable ::osl::Mutex aNotifyMutex;
- mutable ::osl::Mutex maATInterfaceMutex;
AccObjectWinManager(AccObjectManagerAgent* Agent=NULL);
diff --git a/winaccessibility/source/service/AccComponentEventListener.cxx b/winaccessibility/source/service/AccComponentEventListener.cxx
index 5856f6c7b5e2..0374572c452c 100644
--- a/winaccessibility/source/service/AccComponentEventListener.cxx
+++ b/winaccessibility/source/service/AccComponentEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccComponentEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -47,6 +49,8 @@ AccComponentEventListener::~AccComponentEventListener()
void AccComponentEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
switch (aEvent.EventId)
{
case AccessibleEventId::VALUE_CHANGED:
diff --git a/winaccessibility/source/service/AccContainerEventListener.cxx b/winaccessibility/source/service/AccContainerEventListener.cxx
index 05688bc5ff0d..8cb93c446f18 100644
--- a/winaccessibility/source/service/AccContainerEventListener.cxx
+++ b/winaccessibility/source/service/AccContainerEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccContainerEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -47,6 +49,8 @@ AccContainerEventListener::~AccContainerEventListener()
void AccContainerEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
short role = GetRole();
switch (aEvent.EventId)
{
diff --git a/winaccessibility/source/service/AccDescendantManagerEventListener.cxx b/winaccessibility/source/service/AccDescendantManagerEventListener.cxx
index f04dc3bbbacd..6db2bc04bd54 100644
--- a/winaccessibility/source/service/AccDescendantManagerEventListener.cxx
+++ b/winaccessibility/source/service/AccDescendantManagerEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccDescendantManagerEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -47,6 +49,8 @@ AccDescendantManagerEventListener::~AccDescendantManagerEventListener()
void AccDescendantManagerEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
switch (aEvent.EventId)
{
case AccessibleEventId::SELECTION_CHANGED:
diff --git a/winaccessibility/source/service/AccDialogEventListener.cxx b/winaccessibility/source/service/AccDialogEventListener.cxx
index 07e3e3eb5a3f..e0d9a5b3b087 100644
--- a/winaccessibility/source/service/AccDialogEventListener.cxx
+++ b/winaccessibility/source/service/AccDialogEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccDialogEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -44,6 +46,8 @@ AccDialogEventListener::~AccDialogEventListener()
void AccDialogEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
switch (aEvent.EventId)
{
case AccessibleEventId::CHILD:
diff --git a/winaccessibility/source/service/AccEventListener.cxx b/winaccessibility/source/service/AccEventListener.cxx
index 54c4f8727bbf..5a3c687bb967 100644
--- a/winaccessibility/source/service/AccEventListener.cxx
+++ b/winaccessibility/source/service/AccEventListener.cxx
@@ -20,6 +20,9 @@
#include <cppuhelper/bootstrap.hxx>
#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <vcl/svapp.hxx>
+
#include <toolkit/awt/Vclxwindow.hxx>
#ifndef _SV_SYSDATA_HXX
@@ -63,6 +66,7 @@ AccEventListener::~AccEventListener()
void AccEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
switch (aEvent.EventId)
{
@@ -230,7 +234,6 @@ void AccEventListener::RemoveMeFromBroadcaster()
{
try
{
- osl::MutexGuard aGuard(aRemoveMutex);
if(m_isDisposed)
return;
//get accessible context
@@ -276,6 +279,8 @@ void AccEventListener::RemoveMeFromBroadcaster()
void AccEventListener::disposing( const ::com::sun::star::lang::EventObject& /*Source*/ )
throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
RemoveMeFromBroadcaster();
}
diff --git a/winaccessibility/source/service/AccFrameEventListener.cxx b/winaccessibility/source/service/AccFrameEventListener.cxx
index 4c9a687fe389..c9ef5a85d371 100644
--- a/winaccessibility/source/service/AccFrameEventListener.cxx
+++ b/winaccessibility/source/service/AccFrameEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccFrameEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -50,6 +52,8 @@ AccFrameEventListener::~AccFrameEventListener()
void AccFrameEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
switch (aEvent.EventId)
{
case AccessibleEventId::CHILD:
diff --git a/winaccessibility/source/service/AccListEventListener.cxx b/winaccessibility/source/service/AccListEventListener.cxx
index ac8c5408c56f..aa3a0a1c9772 100644
--- a/winaccessibility/source/service/AccListEventListener.cxx
+++ b/winaccessibility/source/service/AccListEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccListEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -46,6 +48,8 @@ AccListEventListener::~AccListEventListener()
*/
void AccListEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
switch (aEvent.EventId)
{
case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED:
diff --git a/winaccessibility/source/service/AccMenuEventListener.cxx b/winaccessibility/source/service/AccMenuEventListener.cxx
index 2cf99eab9c0a..36a96e5a687b 100644
--- a/winaccessibility/source/service/AccMenuEventListener.cxx
+++ b/winaccessibility/source/service/AccMenuEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccMenuEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -44,6 +46,8 @@ AccMenuEventListener::~AccMenuEventListener()
void AccMenuEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
switch (aEvent.EventId)
{
case AccessibleEventId::CHILD:
diff --git a/winaccessibility/source/service/AccObjectWinManager.cxx b/winaccessibility/source/service/AccObjectWinManager.cxx
index 8b5e1ec6c1ad..0a84c38da2b5 100644
--- a/winaccessibility/source/service/AccObjectWinManager.cxx
+++ b/winaccessibility/source/service/AccObjectWinManager.cxx
@@ -134,8 +134,6 @@ AccObjectWinManager::~AccObjectWinManager()
long AccObjectWinManager::Get_ToATInterface( HWND hWnd, long lParam, long wParam)
{
- osl::MutexGuard localGuard(maATInterfaceMutex);//
-
IMAccessible* pRetIMAcc = NULL;
if(lParam == OBJID_CLIENT )
@@ -216,7 +214,8 @@ AccObject* AccObjectWinManager::GetTopWindowAccObj(HWND hWnd)
*/
sal_Bool AccObjectWinManager::NotifyAccEvent(XAccessible* pXAcc,short state)
{
- osl::MutexGuard aGuard(aNotifyMutex);
+ // no idea why this checks for main thread but with this check no mutex
+ // is needed here (the test only accesses Application const member)
if (!IsInMainThread())
{
@@ -564,7 +563,6 @@ void AccObjectWinManager::DeleteFromHwndXAcc(XAccessible* pXAcc )
*/
void AccObjectWinManager::DeleteChildrenAccObj(XAccessible* pXAcc)
{
- osl::MutexGuard aGuard( aDeleteMutex );
AccObject* currentObj=NULL;
AccObject* childObj=NULL;
XAccessible* pTmpXAcc=NULL;
@@ -593,7 +591,6 @@ void AccObjectWinManager::DeleteChildrenAccObj(XAccessible* pXAcc)
*/
void AccObjectWinManager::DeleteAccObj( XAccessible* pXAcc )
{
- osl::MutexGuard aGuard( aDeleteMutex );
if( pXAcc == NULL )
return;
XIdToAccObjHash::iterator temp = XIdAccList.find(pXAcc);
diff --git a/winaccessibility/source/service/AccParagraphEventListener.cxx b/winaccessibility/source/service/AccParagraphEventListener.cxx
index b594c0d2d74a..d3b0b39e503b 100644
--- a/winaccessibility/source/service/AccParagraphEventListener.cxx
+++ b/winaccessibility/source/service/AccParagraphEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccParagraphEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -44,6 +46,8 @@ AccParagraphEventListener::~AccParagraphEventListener()
void AccParagraphEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
switch (aEvent.EventId)
{
case AccessibleEventId::CARET_CHANGED:
diff --git a/winaccessibility/source/service/AccTableEventListener.cxx b/winaccessibility/source/service/AccTableEventListener.cxx
index 19857720c16c..64ba8ca83e81 100644
--- a/winaccessibility/source/service/AccTableEventListener.cxx
+++ b/winaccessibility/source/service/AccTableEventListener.cxx
@@ -24,6 +24,8 @@
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccTableEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -45,6 +47,8 @@ AccTableEventListener::~AccTableEventListener()
void AccTableEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
switch (aEvent.EventId)
{
case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED:
diff --git a/winaccessibility/source/service/AccTextComponentEventListener.cxx b/winaccessibility/source/service/AccTextComponentEventListener.cxx
index 92503556e195..775c31fe7733 100644
--- a/winaccessibility/source/service/AccTextComponentEventListener.cxx
+++ b/winaccessibility/source/service/AccTextComponentEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccTextComponentEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
diff --git a/winaccessibility/source/service/AccTopWindowListener.cxx b/winaccessibility/source/service/AccTopWindowListener.cxx
index c812ea965ce9..87b4b9f7e1db 100644
--- a/winaccessibility/source/service/AccTopWindowListener.cxx
+++ b/winaccessibility/source/service/AccTopWindowListener.cxx
@@ -24,6 +24,7 @@
#include <toolkit/awt/Vclxwindow.hxx>
#include <vcl/sysdata.hxx>
+#include <vcl/svapp.hxx>
#include "AccTopWindowListener.hxx"
#include "unomsaaevent.hxx"
@@ -141,6 +142,8 @@ void AccTopWindowListener::windowOpened( const ::com::sun::star::lang::EventObje
if ( !pAccessible )
return;
+ SolarMutexGuard g;
+
HandleWindowOpened( pAccessible );
}
diff --git a/winaccessibility/source/service/AccTreeEventListener.cxx b/winaccessibility/source/service/AccTreeEventListener.cxx
index 2339f21d41de..6a66356b61d6 100644
--- a/winaccessibility/source/service/AccTreeEventListener.cxx
+++ b/winaccessibility/source/service/AccTreeEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccTreeEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -43,6 +45,8 @@ AccTreeEventListener::~AccTreeEventListener()
*/
void AccTreeEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
switch (aEvent.EventId)
{
case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED:
diff --git a/winaccessibility/source/service/AccWindowEventListener.cxx b/winaccessibility/source/service/AccWindowEventListener.cxx
index e6301dfc51a5..51919903c9d7 100644
--- a/winaccessibility/source/service/AccWindowEventListener.cxx
+++ b/winaccessibility/source/service/AccWindowEventListener.cxx
@@ -23,6 +23,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <vcl/svapp.hxx>
+
#include "AccWindowEventListener.hxx"
#include "AccObjectManagerAgent.hxx"
#include "unomsaaevent.hxx"
@@ -43,6 +45,8 @@ AccWindowEventListener::~AccWindowEventListener()
*/
void AccWindowEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException)
{
+ SolarMutexGuard g;
+
switch (aEvent.EventId)
{
case AccessibleEventId::CHILD:
diff --git a/winaccessibility/source/service/checkmt.cxx b/winaccessibility/source/service/checkmt.cxx
index ad0f2b770647..96535c3ffb03 100644
--- a/winaccessibility/source/service/checkmt.cxx
+++ b/winaccessibility/source/service/checkmt.cxx
@@ -28,9 +28,4 @@ bool IsInMainThread()
return false;
}
-comphelper::SolarMutex& GetSolarMutex()
-{
- return Application::GetSolarMutex();
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/winaccessibility/source/service/checkmt.hxx b/winaccessibility/source/service/checkmt.hxx
index bc5b757a7a8c..2c3a6d47cb7f 100644
--- a/winaccessibility/source/service/checkmt.hxx
+++ b/winaccessibility/source/service/checkmt.hxx
@@ -23,6 +23,4 @@
bool IsInMainThread();
-comphelper::SolarMutex& GetSolarMutex();
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/winaccessibility/source/service/msaaservice_impl.cxx b/winaccessibility/source/service/msaaservice_impl.cxx
index f5bf0fc2185e..6b27c9a913fc 100644
--- a/winaccessibility/source/service/msaaservice_impl.cxx
+++ b/winaccessibility/source/service/msaaservice_impl.cxx
@@ -114,6 +114,8 @@ void MSAAServiceImpl::initialize( Sequence< Any > const & args ) throw (Exceptio
*/
sal_Int32 MSAAServiceImpl::getAccObjectPtr ( long hWnd, long lParam, long wParam) throw (RuntimeException)
{
+ SolarMutexGuard g;
+
return GetMSComPtr( hWnd, lParam, wParam );
}
@@ -125,6 +127,8 @@ sal_Int32 MSAAServiceImpl::getAccObjectPtr ( long hWnd, long lParam, long wParam
*/
void MSAAServiceImpl::handleWindowOpened( sal_Int32 nAcc)
{
+ SolarMutexGuard g;
+
SAL_INFO( "iacc2", "Window opened " << nAcc );
handleWindowOpened_impl( nAcc );
}
@@ -308,6 +312,8 @@ MSAAServiceImpl::~MSAAServiceImpl()
void MSAAServiceImpl::dispose()
{
+ SolarMutexGuard g;
+
// As all folders and streams contain references to their parents,
// we must remove these references so that they will be deleted when
// the hash_map of the root folder is cleared, releasing all subfolders