tdf#155794 winaccessibility: no SolarMutex in getAccObjectPtr()
commitb54b07d7282e500018226a2976104d5f5b524537
authorMichael Stahl <michael.stahl@allotropia.de>
Mon, 12 Jun 2023 18:03:14 +0000 (12 20:03 +0200)
committerMichael Stahl <michael.stahl@allotropia.de>
Wed, 14 Jun 2023 08:47:04 +0000 (14 10:47 +0200)
treeae7bb17c60e1ed1cab589285501caa515f7731dc
parenteb2de384f33875dabb98bf91d682111597d81784
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>
(cherry picked from commit ac1099443e70eefbd8fdd7dd3705fff08a9c75b8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152985
winaccessibility/inc/AccEventListener.hxx
winaccessibility/inc/AccObject.hxx
winaccessibility/inc/AccObjectWinManager.hxx
winaccessibility/source/service/AccEventListener.cxx
winaccessibility/source/service/AccObject.cxx
winaccessibility/source/service/AccObjectWinManager.cxx
winaccessibility/source/service/msaaservice_impl.cxx