vcl/unx/gtk4/a11y.cxx | 4 ++++
1 file changed, 4 insertions(+)
New commits:
commit 085510962a4455f07d7be713adbb6084302c121e
Author: Michael Weghorn <[email protected]>
AuthorDate: Mon Jun 24 10:12:57 2024 +0200
Commit: Michael Weghorn <[email protected]>
CommitDate: Wed Jun 26 05:53:09 2024 +0200
gtk4 a11y: Handle when there's no a11y context
Handle the case where `XAccessible::getAccessibleContext`
returns an empty reference, as e.g.
`VCLXWindow::getAccessibleContext` does when already
disposed.
Fixes an assert/crash seen with the gtk4 VCL plugin
when experimenting with missing menu item handling
in Writer's "Tools" -> "Bibliography Database",
expanding the search filter menu, then closing the dialog
and LO altogether.
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.
(rr) 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 0x00007fe8f96a6b6f in __pthread_kill_internal (signo=6,
threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 0x00007fe8f96584e2 in __GI_raise (sig=sig@entry=6) at
../sysdeps/posix/raise.c:26
#3 0x00007fe8f96414ed in __GI_abort () at ./stdlib/abort.c:79
#4 0x00007fe8f9641415 in __assert_fail_base
(fmt=0x7fe8f97b7ba8 "%s%s%s:%u: %s%sAssertion `%s' failed.
%n", assertion=assertion@entry=0x7fe8e5f1ba3a "_pInterface != NULL",
file=file@entry=0x7fe8e5f46536
".../libreoffice/include/com/sun/star/uno/Reference.h", line=line@entry=387,
function=function@entry=0x7fe8e5f41e71 "interface_type
*com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::operator->()
const [interface_type = com::sun::star::accessibility::XAccessibleContext]")
at ./assert/assert.c:92
#5 0x00007fe8f9651002 in __assert_fail
(assertion=0x7fe8e5f1ba3a "_pInterface != NULL",
file=0x7fe8e5f46536 ".../libreoffice/include/com/sun/star/uno/Reference.h",
line=387, function=0x7fe8e5f41e71 "interface_type
*com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::operator->()
const [interface_type = com::sun::star::accessibility::XAccessibleContext]")
at ./assert/assert.c:101
#6 0x00007fe8e6034e42 in
com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext>::operator->()
const (this=0x7ffe3fddc640) at include/com/sun/star/uno/Reference.h:387
#7 0x00007fe8e6038c14 in
map_accessible_role(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible>
const&) (rAccessible=uno::Reference to (VCLXWindow *) 0x5603d155bba8)
at .../libreoffice/vcl/unx/gtk4/a11y.cxx:56
#8 0x00007fe8e6038a16 in lo_accessible_get_property(_GObject*,
unsigned int, _GValue*, _GParamSpec*) (object=0x5603e5e9fde0, property_id=2,
value=0x7ffe3fddca00, pspec=0x5603bfdc1820)
at .../libreoffice/vcl/unx/gtk4/a11y.cxx:559
#9 0x00007fe8f47be345 in g_object_get_valist () at
/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#10 0x00007fe8f47be8b7 in g_object_get () at
/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#11 0x00007fe8e54d81f8 in gtk_accessible_get_accessible_role
(self=self@entry=0x5603e5e9fde0) at ../gtk/gtkaccessible.c:296
#12 0x00007fe8e54d9447 in gtk_accessible_should_present
(self=self@entry=0x5603e5e9fde0) at ../gtk/gtkaccessible.c:1304
#13 0x00007fe8e575dab8 in get_index_in
(parent=parent@entry=0x5603e4203030, child=child@entry=0x5603e5ea13a0) at
../gtk/a11y/gtkatspicontext.c:398
#14 0x00007fe8e5760213 in gtk_at_spi_context_child_change
(ctx=0x5603e41f8670, change=GTK_ACCESSIBLE_CHILD_CHANGE_REMOVED,
child=0x5603e5ea13a0) at ../gtk/a11y/gtkatspicontext.c:1260
#15 0x00007fe8e575ed8f in gtk_at_spi_context_state_change
(ctx=0x5603e5ea15a0,
changed_states=GTK_ACCESSIBLE_STATE_CHANGE_HIDDEN, changed_properties=0,
changed_relations=<optimized out>, states=0x5603e5ea1770,
properties=0x5603e5ea16b0, relations=0x5603e5ea1710)
at ../gtk/a11y/gtkatspicontext.c:979
#16 0x00007fe8e54e2bdf in gtk_at_context_update (self=0x5603e5ea15a0)
at ../gtk/gtkatcontext.c:831
#17 0x00007fe8e54d839a in gtk_accessible_update_state
(self=self@entry=0x5603e5ea13a0,
first_state=first_state@entry=GTK_ACCESSIBLE_STATE_HIDDEN) at
../gtk/gtkaccessible.c:364
#18 0x00007fe8e5684d4b in gtk_widget_unmap (widget=0x5603e5ea13a0) at
../gtk/gtkwidget.c:2895
#19 gtk_widget_unmap (widget=0x5603e5ea13a0) at ../gtk/gtkwidget.c:2879
#20 0x00007fe8e5684e25 in gtk_widget_real_hide (widget=0x5603e5ea13a0)
at ../gtk/gtkwidget.c:2811
#21 0x00007fe8f47b4939 in () at
/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007fe8f47ca33f in () at
/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007fe8f47cff06 in g_signal_emit_valist () at
/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007fe8f47cffc3 in g_signal_emit () at
/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#25 0x00007fe8e56872cd in gtk_widget_hide (widget=0x5603e5ea13a0) at
../gtk/gtkwidget.c:2787
#26 0x00007fe8e61de10e in GtkSalObjectWidgetClip::Show(bool)
(this=0x5603dafec8f0, bVisible=false) at vcl/unx/gtk4/../gtk3/gtkobject.cxx:534
#27 0x00007fe8efc96b3d in vcl::Window::ImplSysObjClip(vcl::Region
const*) (this=0x5603e5ebb940, pOldRegion=0x0) at
.../libreoffice/vcl/source/window/clipping.cxx:352
#28 0x00007fe8efc96fa0 in vcl::Window::ImplSetClipFlagChildren(bool)
(this=0x5603e5ebb940, bSysObjOnlySmaller=false) at
.../libreoffice/vcl/source/window/clipping.cxx:424
#29 0x00007fe8efc97227 in vcl::Window::ImplSetClipFlag(bool)
(this=0x5603e5ebb940, bSysObjOnlySmaller=false) at
.../libreoffice/vcl/source/window/clipping.cxx:466
#30 0x00007fe8eff2307b in vcl::Window::Show(bool, ShowFlags)
(this=0x5603e5ebb940, bVisible=false, nFlags=ShowFlags::NONE) at
.../libreoffice/vcl/source/window/window.cxx:2238
#31 0x00007fe8efc6a189 in vcl::Window::Hide() (this=0x5603e5ebb940) at
include/vcl/window.hxx:881
#32 0x00007fe8efeac189 in SystemChildWindow::dispose()
(this=0x5603e5ebb940) at .../libreoffice/vcl/source/window/syschild.cxx:121
#33 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce()
(this=0x5603e5ebb950) at
.../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
#34 0x00007fe8e61ad349 in VclPtr<SystemChildWindow>::disposeAndClear()
(this=0x5603e5ea49f0) at include/vcl/vclptr.hxx:207
#35 0x00007fe8e60a30ca in (anonymous
namespace)::GtkInstanceBuilder::~GtkInstanceBuilder() (this=0x5603e5ea4900) at
vcl/unx/gtk4/../gtk3/gtkinst.cxx:24349
#36 0x00007fe8e60a3169 in (anonymous
namespace)::GtkInstanceBuilder::~GtkInstanceBuilder() (this=0x5603e5ea4900) at
vcl/unx/gtk4/../gtk3/gtkinst.cxx:24342
#37 0x00007fe8efe748cf in
std::default_delete<weld::Builder>::operator()(weld::Builder*) const
(this=0x5603e41d6730, __ptr=0x5603e5ea4900) at
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:99
#38 0x00007fe8efe747fc in std::__uniq_ptr_impl<weld::Builder,
std::default_delete<weld::Builder> >::reset(weld::Builder*)
(this=0x5603e41d6730, __p=0x0)
at
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:211
#39 0x00007fe8efff1ffd in std::unique_ptr<weld::Builder,
std::default_delete<weld::Builder> >::reset(weld::Builder*)
(this=0x5603e41d6730, __p=0x0)
at
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:509
#40 0x00007fe8efff16b3 in InterimItemWindow::dispose()
(this=0x5603e41d6660) at
.../libreoffice/vcl/source/control/InterimItemWindow.cxx:49
#41 0x00007fe8a6f57e51 in EditControl::dispose() (this=0x5603e41d6660)
at .../libreoffice/extensions/source/bibliography/toolbar.cxx:209
#42 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce()
(this=0x5603e41d67b8) at
.../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
#43 0x00007fe8a6f5d5f6 in VclPtr<EditControl>::disposeAndClear()
(this=0x5603e5e8e9f0) at include/vcl/vclptr.hxx:207
#44 0x00007fe8a6f5a13c in BibToolBar::dispose() (this=0x5603e5e8e580)
at .../libreoffice/extensions/source/bibliography/toolbar.cxx:272
#45 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce()
(this=0x5603e5e8ea68) at
.../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
#46 0x00007fe8a6edbf09 in VclPtr<BibToolBar>::disposeAndClear()
(this=0x5603e06c1578) at include/vcl/vclptr.hxx:207
#47 0x00007fe8a6edab2e in bib::BibBeamer::dispose()
(this=0x5603e06c1340) at
.../libreoffice/extensions/source/bibliography/bibbeam.cxx:205
#48 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce()
(this=0x5603e06c1588) at
.../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
#49 0x00007fe8a6ef2b49 in VclPtr<vcl::Window>::disposeAndClear()
(this=0x7ffe3fdddcb0) at include/vcl/vclptr.hxx:207
#50 0x00007fe8a6ef173a in BibWindowContainer::dispose()
(this=0x5603e70e5ed0) at
.../libreoffice/extensions/source/bibliography/bibcont.cxx:81
#51 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce()
(this=0x5603e70e5ef8) at
.../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
#52 0x00007fe8a6ef2b49 in VclPtr<vcl::Window>::disposeAndClear()
(this=0x7ffe3fdddd90) at include/vcl/vclptr.hxx:207
#53 0x00007fe8a6ef2043 in BibBookContainer::dispose()
(this=0x5603de460610) at
.../libreoffice/extensions/source/bibliography/bibcont.cxx:126
#54 0x00007fe8f01cd7ca in VclReferenceBase::disposeOnce()
(this=0x5603de460878) at
.../libreoffice/vcl/source/outdev/vclreferencebase.cxx:38
#55 0x00007fe8f1d624a9 in VclPtr<vcl::Window>::disposeAndClear()
(this=0x7ffe3fddded8) at include/vcl/vclptr.hxx:207
#56 0x00007fe8f1d52fe4 in VCLXWindow::dispose() (this=0x5603d155bb40)
at .../libreoffice/toolkit/source/awt/vclxwindow.cxx:926
#57 0x00007fe8f6c28644 in (anonymous
namespace)::XFrameImpl::setComponent(com::sun::star::uno::Reference<com::sun::star::awt::XWindow>
const&, com::sun::star::uno::Reference<com::sun::star::frame::XController>
const&)
(this=0x5603e4174370, xComponentWindow=empty uno::Reference,
xController=empty uno::Reference) at
.../libreoffice/framework/source/services/frame.cxx:1525
#58 0x00007fe8f6c2abc8 in (anonymous
namespace)::XFrameImpl::close(unsigned char) (this=0x5603e4174370,
bDeliverOwnership=0 '
#59 0x00007fe8f6a3a23a in
framework::pattern::frame::closeIt(com::sun::star::uno::Reference<com::sun::star::uno::XInterface>
const&) (xResource=uno::Reference to ((anonymous namespace)::XFrameImpl *)
0x5603e41743e0)
at framework/source/inc/pattern/frame.hxx:57
#60 0x00007fe8f6a38445 in
framework::CloseDispatcher::implts_closeFrame() (this=0x5603e93410a0) at
.../libreoffice/framework/source/dispatch/closedispatcher.cxx:500
#61 0x00007fe8f6a37ab1 in
framework::CloseDispatcher::impl_asyncCallback(LinkParamNone*)
(this=0x5603e93410a0) at
.../libreoffice/framework/source/dispatch/closedispatcher.cxx:379
#62 0x00007fe8f6a35fed in
framework::CloseDispatcher::LinkStubimpl_asyncCallback(void*, LinkParamNone*)
(instance=0x5603e93410a0, data=0x0) at
.../libreoffice/framework/source/dispatch/closedispatcher.cxx:246
#63 0x00007fe8efc40828 in Link<LinkParamNone*,
void>::Call(LinkParamNone*) const (this=0x5603eb162878, data=0x0) at
include/tools/link.hxx:111
#64 0x00007fe8f06cff25 in vcl::EventPoster::DoEvent_Impl(void*)
(this=0x5603eb162870) at .../libreoffice/vcl/source/helper/evntpost.cxx:52
#65 0x00007fe8f06cfedd in vcl::EventPoster::LinkStubDoEvent_Impl(void*,
void*) (instance=0x5603eb162870, data=0x0) at
.../libreoffice/vcl/source/helper/evntpost.cxx:48
#66 0x00007fe8eff4ca78 in Link<void*, void>::Call(void*) const
(this=0x5603dfaf31a8, data=0x0) at include/tools/link.hxx:111
#67 0x00007fe8eff48759 in ImplHandleUserEvent(ImplSVEvent*)
(pSVEvent=0x5603dfaf31a0) at .../libreoffice/vcl/source/window/winproc.cxx:2287
#68 0x00007fe8eff45110 in ImplWindowFrameProc(vcl::Window*, SalEvent,
void const*) (_pWindow=0x5603c9d5cf10, nEvent=SalEvent::UserEvent,
pEvent=0x5603dfaf31a0)
at .../libreoffice/vcl/source/window/winproc.cxx:2851
#69 0x00007fe8f0bd5ba0 in SalFrame::CallCallback(SalEvent, void const*)
const (this=0x5603cb949f00, nEvent=SalEvent::UserEvent, pEvent=0x5603dfaf31a0)
at vcl/inc/salframe.hxx:312
#70 0x00007fe8f0c0072f in
SalGenericDisplay::ProcessEvent(SalUserEventList::SalUserEvent)
(this=0x5603bec36aa0, aEvent=...) at
.../libreoffice/vcl/unx/generic/app/gendisp.cxx:66
#71 0x00007fe8f06e433d in
SalUserEventList::DispatchUserEvents(bool)::$_0::operator()() const
(this=0x7ffe3fddefd0) at .../libreoffice/vcl/source/app/salusereventlist.cxx:119
#72 0x00007fe8f06e41e4 in SalUserEventList::DispatchUserEvents(bool)
(this=0x5603bec36aa0, bHandleAllCurrentEvents=false) at
.../libreoffice/vcl/source/app/salusereventlist.cxx:120
#73 0x00007fe8f0c00685 in
SalGenericDisplay::DispatchInternalEvent(bool) (this=0x5603bec36aa0,
bHandleAllCurrentEvent=false) at
.../libreoffice/vcl/unx/generic/app/gendisp.cxx:51
#74 0x00007fe8e607b706 in call_userEventFn(void*) (data=0x5603beaa55d0)
at vcl/unx/gtk4/../gtk3/gtkdata.cxx:824
#75 0x00007fe8ead1ce3f in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#76 0x00007fe8ead1eec7 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#77 0x00007fe8ead1f4e0 in g_main_context_iteration () at
/lib/x86_64-linux-gnu/libglib-2.0.so.0
#78 0x00007fe8e607a2bf in GtkSalData::Yield(bool, bool)
(this=0x5603beaa55d0, bWait=true, bHandleAllCurrentEvents=false) at
vcl/unx/gtk4/../gtk3/gtkdata.cxx:405
#79 0x00007fe8e6080123 in GtkInstance::DoYield(bool, bool)
(this=0x5603beaa5480, bWait=true, bHandleAllCurrentEvents=false) at
vcl/unx/gtk4/../gtk3/gtkinst.cxx:429
#80 0x00007fe8f07c4d5c in ImplYield(bool, bool) (i_bWait=true,
i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:384
#81 0x00007fe8f07c466b in Application::Yield() () at
.../libreoffice/vcl/source/app/svapp.cxx:472
#82 0x00007fe8f07c4402 in Application::Execute() () at
.../libreoffice/vcl/source/app/svapp.cxx:359
#83 0x00007fe8f9926be0 in desktop::Desktop::Main()
(this=0x7ffe3fde1018) at .../libreoffice/desktop/source/app/app.cxx:1652
#84 0x00007fe8f07e796e in ImplSVMain() () at
.../libreoffice/vcl/source/app/svmain.cxx:229
#85 0x00007fe8f07e9999 in SVMain() () at
.../libreoffice/vcl/source/app/svmain.cxx:261
#86 0x00007fe8f99a9b2c in soffice_main() () at
.../libreoffice/desktop/source/app/sofficemain.cxx:99
#87 0x00005603bca36a5d in sal_main () at
.../libreoffice/desktop/source/app/main.c:51
#88 0x00005603bca36a37 in main (argc=2, argv=0x7ffe3fde1228) at
.../libreoffice/desktop/source/app/main.c:49
Change-Id: Ia3f19d700de66c72f2896595a0e387bd3c42d7ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169451
Reviewed-by: Michael Weghorn <[email protected]>
Tested-by: Jenkins
diff --git a/vcl/unx/gtk4/a11y.cxx b/vcl/unx/gtk4/a11y.cxx
index 4860c7cff33d..1beba84ed67a 100644
--- a/vcl/unx/gtk4/a11y.cxx
+++ b/vcl/unx/gtk4/a11y.cxx
@@ -50,6 +50,10 @@ map_accessible_role(const
css::uno::Reference<css::accessibility::XAccessible>&
{
css::uno::Reference<css::accessibility::XAccessibleContext> xContext(
rAccessible->getAccessibleContext());
+
+ if (!xContext.is())
+ return GTK_ACCESSIBLE_ROLE_NONE;
+
// https://w3c.github.io/core-aam/#mapping_role
//
https://hg.mozilla.org/mozilla-central/file/tip/accessible/base/RoleMap.h
//
https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/a11y/gtkatspiutils.c