From d28687d5171784e1ec23d4cf13d7b3c56cc52782 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 11 Dec 2013 21:40:51 +0100 Subject: winaccessibility: fix locking in UAccCOM The COM components will (usually? always?) be called on the main thread via COM, and may also be called on any thread from the UNO event listeners. Both ways may access the global AccWinObjectManager. So the easiest way to lock all that without introducing new deadlocks seems to be to just use the SolarMutex. The fact that the main thread is in a COM STA is rather irrelevant here since we don't currently do the required manual marshalling of the COM pointers so they can be accessed from UNO event listeners running in threads other than the main thread anyway. To get that to build: - use prewin.h and postwin.h around ATL headers - link UAccCOM against vcl - define both UNICODE and _UNICODE to not break on mis-matching TCHAR nonsense Change-Id: I1ccdf7a4a5c2b5f0b9c29ef39d126c4b8a16898a --- winaccessibility/source/UAccCOM/AccComponentBase.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'winaccessibility/source/UAccCOM/AccComponentBase.cxx') diff --git a/winaccessibility/source/UAccCOM/AccComponentBase.cxx b/winaccessibility/source/UAccCOM/AccComponentBase.cxx index 92efe7f22e52..cc6cf468f064 100644 --- a/winaccessibility/source/UAccCOM/AccComponentBase.cxx +++ b/winaccessibility/source/UAccCOM/AccComponentBase.cxx @@ -21,6 +21,7 @@ #include "AccComponentBase.h" #include #include +#include #include "MAccessible.h" using namespace com::sun::star::accessibility; @@ -45,6 +46,8 @@ CAccComponentBase::~CAccComponentBase() */ STDMETHODIMP CAccComponentBase::get_locationInParent(long *x, long *y) { + SolarMutexGuard g; + try { if (x == NULL || y == NULL) @@ -73,6 +76,8 @@ STDMETHODIMP CAccComponentBase::get_locationInParent(long *x, long *y) */ STDMETHODIMP CAccComponentBase::get_locationOnScreen(long *x, long *y) { + SolarMutexGuard g; + try { if (x == NULL || y == NULL) @@ -100,6 +105,8 @@ STDMETHODIMP CAccComponentBase::get_locationOnScreen(long *x, long *y) */ STDMETHODIMP CAccComponentBase::grabFocus(boolean * success) { + SolarMutexGuard g; + ENTER_PROTECTED_BLOCK if (success == NULL) @@ -124,6 +131,8 @@ STDMETHODIMP CAccComponentBase::grabFocus(boolean * success) */ STDMETHODIMP CAccComponentBase::get_foreground(IA2Color * foreground) { + SolarMutexGuard g; + ENTER_PROTECTED_BLOCK if (foreground == NULL) @@ -147,6 +156,8 @@ STDMETHODIMP CAccComponentBase::get_foreground(IA2Color * foreground) */ STDMETHODIMP CAccComponentBase::get_background(IA2Color * background) { + SolarMutexGuard g; + ENTER_PROTECTED_BLOCK if (background == NULL) @@ -170,6 +181,8 @@ STDMETHODIMP CAccComponentBase::get_background(IA2Color * background) */ STDMETHODIMP CAccComponentBase::put_XInterface(hyper pXInterface) { + // internal IUNOXWrapper - no mutex meeded + ENTER_PROTECTED_BLOCK CUNOXWrapper::put_XInterface(pXInterface); -- cgit