summaryrefslogtreecommitdiff
path: root/winaccessibility/source/UAccCOM/AccComponentBase.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-12-11 21:40:51 +0100
committerMichael Stahl <mstahl@redhat.com>2013-12-12 20:06:26 +0100
commitd28687d5171784e1ec23d4cf13d7b3c56cc52782 (patch)
treecfe0a8c86a0eb7de9273f9a0f8a1e1df10adb0ea /winaccessibility/source/UAccCOM/AccComponentBase.cxx
parentf5a54cbf120efb335205e00ba18a9038449b92c9 (diff)
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
Diffstat (limited to 'winaccessibility/source/UAccCOM/AccComponentBase.cxx')
-rw-r--r--winaccessibility/source/UAccCOM/AccComponentBase.cxx13
1 files changed, 13 insertions, 0 deletions
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 <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <vcl/svapp.hxx>
#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);