summaryrefslogtreecommitdiff
path: root/winaccessibility/inc/AccObjectWinManager.hxx
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-06-12 20:03:14 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-06-13 16:06:59 +0200
commitac1099443e70eefbd8fdd7dd3705fff08a9c75b8 (patch)
tree8ee752d9de435342e00009c93c3f2f0d2599a265 /winaccessibility/inc/AccObjectWinManager.hxx
parentcbb215aa20783523555185c83875ea5d5b94535b (diff)
tdf#155794 winaccessibility: no SolarMutex in getAccObjectPtr()
MSAAServiceImpl::getAccObjectPtr() is called when processing WM_GETOBJECT messages, and this can happen (at least when NVDA is active) during processing SendMessages. When loading a document on a non-main thread, WinSalFrame::SetTitle() calls SetWindowTextW which is equivalent to SendMessage(WM_SETTEXT), while holding SolarMutex, and if the main thread doesn't finish processing it then that's a deadlock. Introduce a new mutex in AccObjectWinManager and use it to guard the 2 members that getAccObjectPtr() reads, while keeping the rest of winaccessibility with the SolarMutex, as the UNO services may be called on any thread. This fixes part of the problem, VCL also needs to stop using SolarMutex. Change-Id: I6df5889fd76f59146b4b0b1e5f4513232f8ab867 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152957 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'winaccessibility/inc/AccObjectWinManager.hxx')
-rw-r--r--winaccessibility/inc/AccObjectWinManager.hxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/winaccessibility/inc/AccObjectWinManager.hxx b/winaccessibility/inc/AccObjectWinManager.hxx
index 5c162dfed1ea..86a75c80fad7 100644
--- a/winaccessibility/inc/AccObjectWinManager.hxx
+++ b/winaccessibility/inc/AccObjectWinManager.hxx
@@ -20,6 +20,8 @@
#pragma once
#include <map>
+#include <mutex>
+
#if !defined WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
@@ -57,6 +59,9 @@ private:
typedef std::map<const HWND, css::accessibility::XAccessible* >
XHWNDToDocumentHash;
+ // guard any access to XIdAccList and HwndXAcc
+ std::recursive_mutex m_Mutex;
+
//XAccessible to AccObject
XIdToAccObjHash XIdAccList;
@@ -80,11 +85,11 @@ private:
long ImpleGenerateResID();
AccObject* GetAccObjByXAcc( css::accessibility::XAccessible* pXAcc);
- AccObject* GetTopWindowAccObj(HWND hWnd);
+ IMAccessible* GetTopWindowIMAccessible(HWND hWnd);
css::accessibility::XAccessible* GetAccDocByHWND(HWND hWnd);
- static void DeleteAccListener( AccObject* pAccObj );
+ static rtl::Reference<AccEventListener> DeleteAccListener(AccObject* pAccObj);
static void InsertAccChildNode(AccObject* pCurObj,AccObject* pParentObj,HWND pWnd);
static void DeleteAccChildNode(AccObject* pChild);
void DeleteFromHwndXAcc(css::accessibility::XAccessible const * pXAcc );