svx/source/accessibility/AccessibleShape.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit df266f613bc12c18ec8d1c9cdc250fda1bc6c45b
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jan 24 10:19:58 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Jan 24 21:35:13 2024 +0100

    svx a11y: Notify listeners when disposing shape
    
    In `AccessibleShape::disposing`, call the same method
    of the base class, i.e. `AccessibleContextBase::disposing`,
    not `AccessibleContextBase::dispose`.
    
    The code was moved from `AccessibleShape::dispose` to
    `AccessibleShape::disposing` in
    
        commit f11b151dc08ccfcb7e78bfd9a24c77670942ea63
        Date:   Tue Apr 30 13:30:10 2002 +0000
    
            #95585# Moved code from dispose to disposing().
    
    and it seems likely that adjusting the base class method to call
    was just forgotten/missed.
    
    This resulted in the accessible getting disposed without listeners
    getting notified (since `AccessibleContextBase::disposing` takes
    care of that).
    
    This resulted in a crash for the following scenario with the qt6
    VCL plugin when the Orca screen reader is running:
    
    1) start LO Writer
    2) click on the "Basic shapes" toolbar button
    3) click + drag to insert a shape into the document
    4) click somewhere else
    
    Backtrace is below.
    `AtSpiAdaptor::handleMessage` (frame #12 in the bt) checks
    whether the accessible is valid and returns early otherwise.
    But since listeners were not notified when the object got disposed,
    `QtAccessibleEventListener::disposing` wasn't called, which would
    have taken care of invalidating the `QtAccessibleWidget`, in which
    case this early return would have happened instead of the crash.
    
    This behaves as expected now with this commit in place.
    
    stderr output of the crash:
    
        terminate called after throwing an instance of 
'com::sun::star::lang::DisposedException'
    
    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  0x00007f5bc1ca815f in __pthread_kill_internal (signo=6, 
threadid=<optimized out>) at ./nptl/pthread_kill.c:78
        #2  0x00007f5bc1c5a472 in __GI_raise (sig=sig@entry=6) at 
../sysdeps/posix/raise.c:26
        #3  0x00007f5bc1c444b2 in __GI_abort () at ./stdlib/abort.c:79
        #4  0x00007f5bc18a09eb in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
        #5  0x00007f5bc18affca in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
        #6  0x00007f5bc18b0035 in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
        #7  0x00007f5bc18b0288 in  () at /lib/x86_64-linux-gnu/libstdc++.so.6
        #8  0x00007f5bc02b4550 in 
accessibility::AccessibleContextBase::ThrowIfDisposed() (this=0x55a6fc7e7da0) 
at .../libreoffice/editeng/source/accessibility/AccessibleContextBase.cxx:494
        #9  0x00007f5bbcf7d54e in 
accessibility::AccessibleShape::getAccessibleName() (this=0x55a6fc7e7da0) at 
.../libreoffice/svx/source/accessibility/AccessibleShape.cxx:280
        #10 0x00007f5bada62107 in QtAccessibleWidget::text(QAccessible::Text) 
const (this=0x55a6fad4fe20, text=QAccessible::Name) at 
.../libreoffice/vcl/qt6/../qt5/QtAccessibleWidget.cxx:362
        #11 0x00007f5bac5552d2 in 
AtSpiAdaptor::accessibleInterface(QAccessibleInterface*, QString const&, 
QDBusMessage const&, QDBusConnection const&) (this=0x55a6f769bce0, 
interface=0x55a6fad4fe20, function=..., message=..., connection=...)
            at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1545
        #12 0x00007f5bac553cce in AtSpiAdaptor::handleMessage(QDBusMessage 
const&, QDBusConnection const&) (this=0x55a6f769bce0, message=..., 
connection=...)
            at .../qt5/qtbase/src/gui/accessible/linux/atspiadaptor.cpp:1432
        #13 0x00007f5baaa88943 in 
QDBusConnectionPrivate::activateObject(QDBusConnectionPrivate::ObjectTreeNode&, 
QDBusMessage const&, int) (this=0x7f5ba4010f30, node=..., msg=..., 
pathStartPos=27)
            at .../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1448
        #14 0x00007f5baaa89628 in 
QDBusActivateObjectEvent::placeMetaCall(QObject*) (this=0x7f5ba4026980) at 
.../qt5/qtbase/src/dbus/qdbusintegrator.cpp:1604
        #15 0x00007f5bad044013 in QObject::event(QEvent*) (this=0x55a6f769bce0, 
e=0x7f5ba4026980) at .../qt5/qtbase/src/corelib/kernel/qobject.cpp:1447
        #16 0x00007f5bab1a6986 in QApplicationPrivate::notify_helper(QObject*, 
QEvent*) (this=0x55a6f631c3e0, receiver=0x55a6f769bce0, e=0x7f5ba4026980) at 
.../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3298
        #17 0x00007f5bab1a6797 in QApplication::notify(QObject*, QEvent*) 
(this=0x55a6f63bb840, receiver=0x55a6f769bce0, e=0x7f5ba4026980) at 
.../qt5/qtbase/src/widgets/kernel/qapplication.cpp:3249
        #18 0x00007f5bacfb0212 in QCoreApplication::notifyInternal2(QObject*, 
QEvent*) (receiver=0x55a6f769bce0, event=0x7f5ba4026980) at 
.../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1138
        #19 0x00007f5bacfb0dbb in QCoreApplication::sendEvent(QObject*, 
QEvent*) (receiver=0x55a6f769bce0, event=0x7f5ba4026980) at 
.../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1581
        #20 0x00007f5bacfb2474 in 
QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) 
(receiver=0x0, event_type=0, data=0x55a6f6337df0) at 
.../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1936
        #21 0x00007f5bacfb160e in QCoreApplication::sendPostedEvents(QObject*, 
int) (receiver=0x0, event_type=0) at 
.../qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1770
        #22 0x00007f5bad43441c in postEventSourceDispatch(GSource*, 
GSourceFunc, gpointer) (s=0x55a6f642f710) at 
.../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:244
        #23 0x00007f5bb47111f4 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
        #24 0x00007f5bb4714317 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
        #25 0x00007f5bb4714930 in g_main_context_iteration () at 
/lib/x86_64-linux-gnu/libglib-2.0.so.0
        #26 0x00007f5bad434cb1 in 
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 
(this=0x55a6f6435dc0, flags=...) at 
.../qt5/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:394
        #27 0x00007f5baa929e18 in 
QXcbGlibEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) 
(this=0x55a6f6435dc0, flags=...) at 
.../qt5/qtbase/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp:96
        #28 0x00007f5badad8bea in QtInstance::ImplYield(bool, bool) 
(this=0x55a6f6442080, bWait=true, bHandleAllCurrentEvents=false) at 
.../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:424
        #29 0x00007f5badad8d13 in QtInstance::DoYield(bool, bool) 
(this=0x55a6f6442080, bWait=true, bHandleAllCurrentEvents=false) at 
.../libreoffice/vcl/qt6/../qt5/QtInstance.cxx:435
        #30 0x00007f5bb8734af6 in ImplYield(bool, bool) (i_bWait=true, 
i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:386
        #31 0x00007f5bb8735894 in Application::Yield() () at 
.../libreoffice/vcl/source/app/svapp.cxx:470
        #32 0x00007f5bb87347e9 in Application::Execute() () at 
.../libreoffice/vcl/source/app/svapp.cxx:364
        #33 0x00007f5bc1e36e66 in desktop::Desktop::Main() 
(this=0x7ffc62160570) at .../libreoffice/desktop/source/app/app.cxx:1614
        #34 0x00007f5bb8753ca0 in ImplSVMain() () at 
.../libreoffice/vcl/source/app/svmain.cxx:229
        #35 0x00007f5bb8753fb5 in SVMain() () at 
.../libreoffice/vcl/source/app/svmain.cxx:261
        #36 0x00007f5bc1ea4101 in soffice_main() () at 
.../libreoffice/desktop/source/app/sofficemain.cxx:94
        #37 0x000055a6f46e19d4 in sal_main () at 
.../libreoffice/desktop/source/app/main.c:51
        #38 0x000055a6f46e19ba in main (argc=2, argv=0x7ffc62160798) at 
.../libreoffice/desktop/source/app/main.c:49
    
    Change-Id: Iae8a9ff61df99094b4cd73da895d1f6ac850c0c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162493
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit 77874b76c50d704b26543175375dcfa65c4fd620)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162537
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/svx/source/accessibility/AccessibleShape.cxx 
b/svx/source/accessibility/AccessibleShape.cxx
index 1edc2c8a2668..7a1770b8fd42 100644
--- a/svx/source/accessibility/AccessibleShape.cxx
+++ b/svx/source/accessibility/AccessibleShape.cxx
@@ -1018,7 +1018,7 @@ void AccessibleShape::disposing()
     maShapeTreeInfo.dispose();
 
     // Call base classes.
-    AccessibleContextBase::dispose ();
+    AccessibleContextBase::disposing();
 }
 
 sal_Int64 SAL_CALL

Reply via email to