tdf#155794 winaccessibility: no SolarMutex in getAccObjectPtr()
commitaf1e9f9b8726b84dc5c6e644ed317873dacbe1f5
authorMichael Stahl <michael.stahl@allotropia.de>
Mon, 12 Jun 2023 18:03:14 +0000 (12 20:03 +0200)
committerMichael Stahl <michael.stahl@allotropia.de>
Mon, 12 Jun 2023 18:03:14 +0000 (12 20:03 +0200)
treef0b30ee6d0b8a39b598bcc2283e1399244918a6b
parent9a9424a65d2f04bd3de0f9b1c3f453da50d3dd06
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
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