sw/source/uibase/docvw/SidebarWinAcc.cxx |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

New commits:
commit 512b09ec51cfbe9bb0ce1a7f229b443dc427f6f3
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Feb 14 15:57:54 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Feb 16 09:10:54 2024 +0100

    tdf#92389 sw a11y: Use SolarMutex in SidebarWinAccessibleContext
    
    Hold the SolarMutex instead of of using a custom mutex,
    since `SwAccessibleMap` methods that get called require
    the SolarMutex to be held.
    
    Fixes a crash/assert when interacting with Writer comments
    using the mouse while the Orca screen reader is running
    when using the qt6 VCL plugin.
    
    Backtrace:
    
        Thread 1 received signal SIGABRT, Aborted.
        __pthread_kill_implementation (threadid=<optimized out>, 
signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
        44      ./nptl/pthread_kill.c: No such file or directory.
        (gdb) bt
        #0  __pthread_kill_implementation (threadid=<optimized out>, 
signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
        #1  0x00007f0a462a81cf in __pthread_kill_internal (signo=6, 
threadid=<optimized out>) at ./nptl/pthread_kill.c:78
        #2  0x00007f0a4625a472 in __GI_raise (sig=sig@entry=6) at 
../sysdeps/posix/raise.c:26
        #3  0x00007f0a462444b2 in __GI_abort () at ./stdlib/abort.c:79
        #4  0x00007f0a462443d5 in __assert_fail_base
            (fmt=0x7f0a463b8dc8 "%s%s%s:%u: %s%sAssertion `%s' failed.
%n", assertion=assertion@entry=0x7f0a3d775838 
"ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex 
not owned!\"", file=file@entry=0x7f0a3d7757f0 
".../libreoffice/vcl/source/app/dbggui.cxx", line=line@entry=35, 
function=function@entry=0x7f0a3d7757cc "void ImplDbgTestSolarMutex()") at 
./assert/assert.c:92
        #5  0x00007f0a462533a2 in __assert_fail
            (assertion=0x7f0a3d775838 
"ImplGetSVData()->mpDefInst->GetYieldMutex()->IsCurrentThread() && \"SolarMutex 
not owned!\"", file=0x7f0a3d7757f0 ".../libreoffice/vcl/source/app/dbggui.cxx", 
line=35, function=0x7f0a3d7757cc "void ImplDbgTestSolarMutex()") at 
./assert/assert.c:101
        #6  0x00007f0a3ca733b4 in ImplDbgTestSolarMutex() () at 
.../libreoffice/vcl/source/app/dbggui.cxx:35
        #7  0x00007f0a452ccfbb in DbgTestSolarMutex() () at 
.../libreoffice/tools/source/debug/debug.cxx:54
        #8  0x00007f09f8fd3903 in SwAccessibleMap::GetContext(SwFrame const*, 
bool) (this=0x55fa8fd89930, pFrame=0x55fa8ecddb00, bCreate=false) at 
.../libreoffice/sw/source/core/access/accmap.cxx:1777
        #9  0x00007f09f906f684 in sw::sidebarwindows::(anonymous 
namespace)::SidebarWinAccessibleContext::getAccessibleParent() 
(this=0x55fa8f83e600) at 
.../libreoffice/sw/source/uibase/docvw/SidebarWinAcc.cxx:65
        #10 0x00007f0a31e6244c in QtAccessibleWidget::parent() const 
(this=0x7f0a280b6150) at 
.../libreoffice/vcl/qt6/../qt5/QtAccessibleWidget.cxx:322
        #11 0x00007f0a3095b51a in 
AtSpiAdaptor::accessibleInterface(QAccessibleInterface*, QString const&, 
QDBusMessage const&, QDBusConnection const&) (this=0x55fa884876c0, 
interface=0x7f0a280b6150, function=..., message=..., connection=...)
            at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1592
        #12 0x00007f0a30959934 in AtSpiAdaptor::handleMessage(QDBusMessage 
const&, QDBusConnection const&) (this=0x55fa884876c0, message=..., 
connection=...)
            at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1460
        #13 0x00007f0a2ee88ad3 in 
QDBusConnectionPrivate::activateObject(QDBusConnectionPrivate::ObjectTreeNode&, 
QDBusMessage const&, int) (this=0x7f0a28010b60, node=..., msg=..., 
pathStartPos=27)
            at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1448
        #14 0x00007f0a2ee897b8 in 
QDBusActivateObjectEvent::placeMetaCall(QObject*) (this=0x7f0a280b8400) at 
.../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1604
        #15 0x00007f0a31445095 in QObject::event(QEvent*) (this=0x55fa884876c0, 
e=0x7f0a280b8400) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:1447
        #16 0x00007f0a2f5a696c in QApplicationPrivate::notify_helper(QObject*, 
QEvent*) (this=0x55fa872f63e0, receiver=0x55fa884876c0, e=0x7f0a280b8400) at 
.../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3298
        #17 0x00007f0a2f5a677d in QApplication::notify(QObject*, QEvent*) 
(this=0x55fa873956b0, receiver=0x55fa884876c0, e=0x7f0a280b8400) at 
.../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3249
        #18 0x00007f0a313b1162 in QCoreApplication::notifyInternal2(QObject*, 
QEvent*) (receiver=0x55fa884876c0, event=0x7f0a280b8400) at 
.../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1138
        #19 0x00007f0a313b1d0b in QCoreApplication::sendEvent(QObject*, 
QEvent*) (receiver=0x55fa884876c0, event=0x7f0a280b8400) at 
.../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1581
        #20 0x00007f0a313b33c4 in 
QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) 
(receiver=0x0, event_type=0, data=0x55fa87311df0) at 
.../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1936
        #21 0x00007f0a313b255e in QCoreApplication::sendPostedEvents(QObject*, 
int) (receiver=0x0, event_type=0) at 
.../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1770
        #22 0x00007f0a318384ac in postEventSourceDispatch(GSource*, 
GSourceFunc, gpointer) (s=0x55fa873b8c20) at 
.../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:244
        #23 0x00007f0a38d111f4 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
        #24 0x00007f0a38d14317 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
        #25 0x00007f0a38d14930 in g_main_context_iteration () at 
/lib/x86_64-linux-gnu/libglib-2.0.so.0
        #26 0x00007f0a31838d41 in 
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 
(this=0x55fa873987a0, flags=...) at 
.../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:394
        #27 0x00007f0a30b5c418 in 
QPAEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 
(this=0x55fa873987a0, flags=...) at 
.../qt5/qtbase/src/gui/platform/unix/qeventdispatcher_glib.cpp:87
        #28 0x00007f0a31ed9a40 in QtInstance::ImplYield(bool, bool) 
(this=0x55fa873d30f0, bWait=true, bHandleAllCurrentEvents=false) at 
.../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:453
        #29 0x00007f0a31ed9b69 in QtInstance::DoYield(bool, bool) 
(this=0x55fa873d30f0, bWait=true, bHandleAllCurrentEvents=false) at 
.../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:464
        #30 0x00007f0a3cb39434 in ImplYield(bool, bool) (i_bWait=true, 
i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:390
        #31 0x00007f0a3cb3a1d2 in Application::Yield() () at 
.../libreoffice/vcl/source/app/svapp.cxx:474
        #32 0x00007f0a3cb39127 in Application::Execute() () at 
.../libreoffice/vcl/source/app/svapp.cxx:368
        #33 0x00007f0a46437216 in desktop::Desktop::Main() 
(this=0x7ffd0478dce0) at .../libreoffice/desktop/source/app/app.cxx:1614
        #34 0x00007f0a3cb585f6 in ImplSVMain() () at 
.../libreoffice/vcl/source/app/svmain.cxx:229
        #35 0x00007f0a3cb5890b in SVMain() () at 
.../libreoffice/vcl/source/app/svmain.cxx:261
        #36 0x00007f0a464a4367 in soffice_main() () at 
.../libreoffice/desktop/source/app/sofficemain.cxx:94
        #37 0x000055fa860a09d4 in sal_main () at 
.../libreoffice/desktop/source/app/main.c:51
        #38 0x000055fa860a09ba in main (argc=3, argv=0x7ffd0478df08) at 
.../libreoffice/desktop/source/app/main.c:49
    
    Change-Id: If6df884fe94b2aac74be1b9fb13356bf765119d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163379
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sw/source/uibase/docvw/SidebarWinAcc.cxx 
b/sw/source/uibase/docvw/SidebarWinAcc.cxx
index f489bc140b6b..3b2b4c758e93 100644
--- a/sw/source/uibase/docvw/SidebarWinAcc.cxx
+++ b/sw/source/uibase/docvw/SidebarWinAcc.cxx
@@ -23,9 +23,9 @@
 #include <viewsh.hxx>
 #include <accmap.hxx>
 #include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <vcl/svapp.hxx>
 
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <mutex>
 
 namespace sw::sidebarwindows {
 
@@ -47,7 +47,7 @@ class SidebarWinAccessibleContext : public 
VCLXAccessibleComponent
 
         void ChangeAnchor( const SwFrame* pAnchorFrame )
         {
-            std::scoped_lock aGuard(maMutex);
+            SolarMutexGuard aGuard;
 
             mpAnchorFrame = pAnchorFrame;
         }
@@ -55,7 +55,7 @@ class SidebarWinAccessibleContext : public 
VCLXAccessibleComponent
         virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL
             getAccessibleParent() override
         {
-            std::scoped_lock aGuard(maMutex);
+            SolarMutexGuard aGuard;
 
             css::uno::Reference< css::accessibility::XAccessible > xAccParent;
 
@@ -70,7 +70,7 @@ class SidebarWinAccessibleContext : public 
VCLXAccessibleComponent
 
         virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
         {
-            std::scoped_lock aGuard(maMutex);
+            SolarMutexGuard aGuard;
 
             sal_Int64 nIndex( -1 );
 
@@ -87,8 +87,6 @@ class SidebarWinAccessibleContext : public 
VCLXAccessibleComponent
     private:
         SwViewShell& mrViewShell;
         const SwFrame* mpAnchorFrame;
-
-        std::mutex maMutex;
 };
 
 }

Reply via email to