diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2024-04-26 12:43:24 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2024-04-26 20:18:30 +0200 |
commit | f6ca163d3f6383d3a48dbdacc5410e630d678ea1 (patch) | |
tree | 21b9367fc12fda077cd94ce6433722610c885842 /xmloff | |
parent | 707e4f12f11efa3ef575adf549cafb8ecdbfa045 (diff) |
gtk4 a11y: Don't create second AT context for OOoFixed
Similar to how the previous
Change-Id: I35196ca686e9d56f97bbf884da8b6492358e41fc
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Fri Apr 26 09:45:39 2024 +0200
gtk4 a11y: Don't create multiple AT contexts for same accessible
avoids creating multiple AT contexts for the same
accessible when the role changes, this commit addresses
another case in which 2 GtkATContexts could be created
for the OOoFixed which could result in segfault crashes:
The OOoFixed is a GtkWidget, and GTK's `gtk_widget_init`
already creates an AT context for widgets.
Then, a second AT context would be created because
`ooo_fixed_accessible_init` set an own implementation
for GtkAccessibleInterface::get_at_context that would
create a second AT context when it got called, resulting
in breaking the apparent assumption that there's a 1:1 mapping
between GtkAccessible and GtkATConetxt.
No longer override `GtkAccessibleInterface::get_at_context`
but live with the GtkATContext created for the GtkWidget,
even if that means an a11y role cannot explicitly be set
for these for now.
From a first quick look at the tree in Accerciser,
I only see one item changed its a11y role from panel to filler.
The main class used. e.g. for the document content is
LOAccessible, not OOoFixed, and setting the proper role
for instances of that class is unaffected, see
`lo_accessible_get_at_context`.
If setting the a11y role is relevant, this could be
done when initializing the OOoFixed instead by setting
the "accessible-role" property [1], tested with this demo
local change to set a dummy table-cell a11y role and
verifying in Accerciser that it was actually set:
--- a/vcl/unx/gtk3/gtkframe.cxx
+++ b/vcl/unx/gtk3/gtkframe.cxx
@@ -993,7 +993,10 @@ void GtkSalFrame::InitCommon()
#else
m_pOverlay = GTK_OVERLAY(gtk_overlay_new());
#if GTK_CHECK_VERSION(4,9,0)
- m_pFixedContainer = GTK_FIXED(g_object_new( ooo_fixed_get_type(), nullptr ));
+ GValue aValue = G_VALUE_INIT;
+ g_value_init (&aValue, GTK_TYPE_ACCESSIBLE_ROLE);
+ g_value_set_enum(&aValue, GTK_ACCESSIBLE_ROLE_CELL);
+ m_pFixedContainer = GTK_FIXED(g_object_new( ooo_fixed_get_type(), "accessible-role", aValue, nullptr ));
#else
m_pFixedContainer = GTK_FIXED(gtk_fixed_new());
#endif
Similar to how the dropped code did, this could use the
a11y role from the corresponding `vcl::Window`, which is
currently not passed, but that could be adjusted, e.g.
by either passing the window or its accessible info
to `SalInstance::CreateFrame`/`SalInstance::CreateChildFrame`.
See `Window::ImplInit`, where the `vcl::Window` is currently
only set via `SalFrame::SetCallback` after the call to
`SalInstance::CreateFrame`/`SalInstance::CreateChildFrame`.
Without this commit, for me, this crash happened about 10-30 %
of the time when starting LO Writer with the gtk4 VCL plugin in rr,
when Accerciser was running already.
Backtrace for first AT context creation (from `gtk_widget_init`):
1 gtk_at_context_create gtkatcontext.c 671 0x7f677daf129e
2 create_at_context gtkwidget.c 8574 0x7f677dd6bcd9
3 gtk_widget_init gtkwidget.c 2392 0x7f677dd5edbc
4 g_type_create_instance 0x7f678ed8f2a3
5 ?? 0x7f678ed72500
6 g_object_new_with_properties 0x7f678ed73b96
7 g_object_new 0x7f678ed74a41
8 GtkSalFrame::InitCommon gtkframe.cxx 996 0x7f677edb9243
9 GtkSalFrame::Init gtkframe.cxx 1785 0x7f677edb7bca
10 GtkSalFrame::GtkSalFrame gtkframe.cxx 510 0x7f677edb726d
11 GtkInstance::CreateFrame gtkinst.cxx 273 0x7f677ec7cebc
12 vcl::Window::ImplInit window.cxx 1057 0x7f6788cf7f49
13 ImplBorderWindow::ImplInit brdwin.cxx 1555 0x7f6788a6d45b
14 ImplBorderWindow::ImplBorderWindow brdwin.cxx 1584 0x7f6788a6da21
15 VclPtrInstance<ImplBorderWindow>::VclPtrInstance<vcl::Window *&, SystemParentData *&, long&, BorderWindowStyle&> vclptr.hxx 280 0x7f6788d31049
16 WorkWindow::ImplInit wrkwin.cxx 51 0x7f6788d2f809
17 IntroWindow::IntroWindow introwin.cxx 35 0x7f6788bb7ee0
18 (anonymous namespace)::SplashScreenWindow::SplashScreenWindow splash.cxx 122 0x7f677c1cee61
19 VclPtr<(anonymous namespace)::SplashScreenWindow>::Create<(anonymous namespace)::SplashScreen *> vclptr.hxx 129 0x7f677c1cc86b
20 (anonymous namespace)::SplashScreen::SplashScreen splash.cxx 145 0x7f677c1cc5f8
21 desktop_SplashScreen_get_implementation splash.cxx 616 0x7f677c1cc4f9
22 std::__invoke_impl<com::sun::star::uno::XInterface *, com::sun::star::uno::XInterface * ( *&)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&> invoke.h 61 0x7f67907ef7a8
23 std::__invoke_r<com::sun::star::uno::XInterface *, com::sun::star::uno::XInterface * ( *&)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&> invoke.h 114 0x7f67907ef745
24 std::_Function_handler<com::sun::star::uno::XInterface * (com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XInterface * ( *)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::_M_invoke(std::_Any_data const&, com::sun::star::uno::XComponentContext *&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) std_function.h 290 0x7f67907ef63d
25 std::function<com::sun::star::uno::XInterface * (com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::operator()(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) const std_function.h 591 0x7f67907b6848
26 cppuhelper::ServiceManager::Data::Implementation::doCreateInstanceWithArguments servicemanager.cxx 725 0x7f679079f26f
27 cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments servicemanager.cxx 696 0x7f679079f143
28 cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext servicemanager.cxx 1021 0x7f67907a56c5
29 non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) servicemanager.cxx 1022 0x7f67907a577c
30 desktop::Desktop::OpenSplashScreen app.cxx 2449 0x7f6792723b2c
31 desktop::Desktop::Main app.cxx 1299 0x7f6792721362
32 ImplSVMain svmain.cxx 229 0x7f67895bcfbe
33 SVMain svmain.cxx 261 0x7f67895bf009
34 soffice_main sofficemain.cxx 93 0x7f67927a5a73
35 sal_main main.c 51 0x55fa1fbf7a5d
36 main main.c 49 0x55fa1fbf7a37
Backtrace for second AT context creation:
1 gtk_at_context_create gtkatcontext.c 671 0x7f677daf129e
2 get_at_context a11y.cxx 806 0x7f677ec389b6
3 gtk_accessible_get_at_context gtkaccessible.c 105 0x7f677dae2d4b
4 gtk_accessible_platform_changed gtkaccessible.c 1081 0x7f677dae427d
5 gtk_widget_set_focusable gtkwidget.c 5255 0x7f677dd65086
6 GtkSalFrame::InitCommon gtkframe.cxx 1157 0x7f677edb9d15
7 GtkSalFrame::Init gtkframe.cxx 1785 0x7f677edb7bca
8 GtkSalFrame::GtkSalFrame gtkframe.cxx 510 0x7f677edb726d
9 GtkInstance::CreateFrame gtkinst.cxx 273 0x7f677ec7cebc
10 vcl::Window::ImplInit window.cxx 1057 0x7f6788cf7f49
11 ImplBorderWindow::ImplInit brdwin.cxx 1555 0x7f6788a6d45b
12 ImplBorderWindow::ImplBorderWindow brdwin.cxx 1584 0x7f6788a6da21
13 VclPtrInstance<ImplBorderWindow>::VclPtrInstance<vcl::Window *&, SystemParentData *&, long&, BorderWindowStyle&> vclptr.hxx 280 0x7f6788d31049
14 WorkWindow::ImplInit wrkwin.cxx 51 0x7f6788d2f809
15 IntroWindow::IntroWindow introwin.cxx 35 0x7f6788bb7ee0
16 (anonymous namespace)::SplashScreenWindow::SplashScreenWindow splash.cxx 122 0x7f677c1cee61
17 VclPtr<(anonymous namespace)::SplashScreenWindow>::Create<(anonymous namespace)::SplashScreen *> vclptr.hxx 129 0x7f677c1cc86b
18 (anonymous namespace)::SplashScreen::SplashScreen splash.cxx 145 0x7f677c1cc5f8
19 desktop_SplashScreen_get_implementation splash.cxx 616 0x7f677c1cc4f9
20 std::__invoke_impl<com::sun::star::uno::XInterface *, com::sun::star::uno::XInterface * ( *&)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&> invoke.h 61 0x7f67907ef7a8
21 std::__invoke_r<com::sun::star::uno::XInterface *, com::sun::star::uno::XInterface * ( *&)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&> invoke.h 114 0x7f67907ef745
22 std::_Function_handler<com::sun::star::uno::XInterface * (com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&), com::sun::star::uno::XInterface * ( *)(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::_M_invoke(std::_Any_data const&, com::sun::star::uno::XComponentContext *&&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) std_function.h 290 0x7f67907ef63d
23 std::function<com::sun::star::uno::XInterface * (com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&)>::operator()(com::sun::star::uno::XComponentContext *, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&) const std_function.h 591 0x7f67907b6848
24 cppuhelper::ServiceManager::Data::Implementation::doCreateInstanceWithArguments servicemanager.cxx 725 0x7f679079f26f
25 cppuhelper::ServiceManager::Data::Implementation::createInstanceWithArguments servicemanager.cxx 696 0x7f679079f143
26 cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext servicemanager.cxx 1021 0x7f67907a56c5
27 non-virtual thunk to cppuhelper::ServiceManager::createInstanceWithArgumentsAndContext(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any> const&, com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&) servicemanager.cxx 1022 0x7f67907a577c
28 desktop::Desktop::OpenSplashScreen app.cxx 2449 0x7f6792723b2c
29 desktop::Desktop::Main app.cxx 1299 0x7f6792721362
30 ImplSVMain svmain.cxx 229 0x7f67895bcfbe
31 SVMain svmain.cxx 261 0x7f67895bf009
32 soffice_main sofficemain.cxx 93 0x7f67927a5a73
33 sal_main main.c 51 0x55fa1fbf7a5d
34 main main.c 49 0x55fa1fbf7a37
Backtrace of the segfault:
Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007f677deaec8e in GTK_IS_ACCESSIBLE_TEXT (ptr=0x55fa21196bb0) at ../gtk/gtkaccessibletext.h:35
35 G_DECLARE_INTERFACE (GtkAccessibleText, gtk_accessible_text, GTK, ACCESSIBLE_TEXT, GtkAccessible)
(rr) bt
#0 0x00007f677deaec8e in GTK_IS_ACCESSIBLE_TEXT (ptr=0x55fa21196bb0) at ../gtk/gtkaccessibletext.h:35
#1 0x00007f677deb1d88 in gtk_atspi_connect_text_signals (accessible=0x55fa21196bb0, text_changed=0x7f677dea1365 <emit_text_changed>, selection_changed=0x7f677dea140b <emit_text_selection_changed>, data=0x55fa2119d860)
at ../gtk/a11y/gtkatspitext.c:1037
#2 0x00007f677dea2fea in register_object (root=0x55fa2119e210, context=0x55fa2119d860) at ../gtk/a11y/gtkatspicontext.c:1442
#3 0x00007f677dea8138 in on_registration_reply (gobject=0x55fa21179030, result=0x55fa39240d80, user_data=0x55fa2117a4a0) at ../gtk/a11y/gtkatspiroot.c:531
#4 0x00007f6783cc8ee3 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#5 0x00007f6783cc9b83 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#6 0x00007f6783d269da in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#7 0x00007f6783cc8ee3 in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#8 0x00007f6783cc8f1d in () at /lib/x86_64-linux-gnu/libgio-2.0.so.0
#9 0x00007f6785b110d9 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#10 0x00007f6785b14317 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#11 0x00007f6785b14930 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#12 0x00007f677ec77d0f in GtkSalData::Yield(bool, bool) (this=0x55fa1fe8e000, bWait=true, bHandleAllCurrentEvents=false) at vcl/unx/gtk4/../gtk3/gtkdata.cxx:405
#13 0x00007f677ec7dbd3 in GtkInstance::DoYield(bool, bool) (this=0x55fa1fe8deb0, bWait=true, bHandleAllCurrentEvents=false) at vcl/unx/gtk4/../gtk3/gtkinst.cxx:435
#14 0x00007f678959a64c in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:394
#15 0x00007f6789599f5b in Application::Yield() () at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:482
#16 0x00007f6789599cf2 in Application::Execute() () at /home/michi/development/git/libreoffice/vcl/source/app/svapp.cxx:369
#17 0x00007f679272304c in desktop::Desktop::Main() (this=0x7ffdf3dcc768) at /home/michi/development/git/libreoffice/desktop/source/app/app.cxx:1615
#18 0x00007f67895bcfbe in ImplSVMain() () at /home/michi/development/git/libreoffice/vcl/source/app/svmain.cxx:229
#19 0x00007f67895bf009 in SVMain() () at /home/michi/development/git/libreoffice/vcl/source/app/svmain.cxx:261
#20 0x00007f67927a5a73 in soffice_main() () at /home/michi/development/git/libreoffice/desktop/source/app/sofficemain.cxx:93
#21 0x000055fa1fbf7a5d in sal_main () at /home/michi/development/git/libreoffice/desktop/source/app/main.c:51
#22 0x000055fa1fbf7a37 in main (argc=2, argv=0x7ffdf3dcc978) at /home/michi/development/git/libreoffice/desktop/source/app/main.c:49
[1] https://docs.gtk.org/gtk4/property.Accessible.accessible-role.html
Change-Id: If4fdcd249aaada846934c3e967d654e3266ad73d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166709
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'xmloff')
0 files changed, 0 insertions, 0 deletions