summaryrefslogtreecommitdiff
path: root/winaccessibility/source/service/AccEventListener.cxx
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/source/service/AccEventListener.cxx
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/source/service/AccEventListener.cxx')
-rw-r--r--winaccessibility/source/service/AccEventListener.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/winaccessibility/source/service/AccEventListener.cxx b/winaccessibility/source/service/AccEventListener.cxx
index b6b4e71f3aaa..a8f8e705fd2c 100644
--- a/winaccessibility/source/service/AccEventListener.cxx
+++ b/winaccessibility/source/service/AccEventListener.cxx
@@ -216,7 +216,7 @@ short AccEventListener::GetParentRole()
/**
* remove the listener from accessible object
*/
-void AccEventListener::RemoveMeFromBroadcaster()
+void AccEventListener::RemoveMeFromBroadcaster(bool const isNotifyDestroy)
{
try
{
@@ -237,7 +237,10 @@ void AccEventListener::RemoveMeFromBroadcaster()
catch (Exception const&)
{ // may throw if it's already disposed - ignore that
}
- pAgent->NotifyDestroy(m_xAccessible.get());
+ if (isNotifyDestroy)
+ {
+ pAgent->NotifyDestroy(m_xAccessible.get());
+ }
m_xAccessible.clear(); // release cyclic reference
}
catch (...)
@@ -253,7 +256,7 @@ void AccEventListener::disposing(const css::lang::EventObject& /*Source*/)
{
SolarMutexGuard g;
- RemoveMeFromBroadcaster();
+ RemoveMeFromBroadcaster(true);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */