Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qt5 a11y: Skip attributes without value
Skip attributes with empty string value in 'Qt5AccessibleWidget::attributes'. Besides not being a useful value, I also got a crash using Accerciser to navigate in Calc's "Format Cells" dialog -> "Font Effects" -> "Text Decoration" -> "Overlining" -> "Overlining". 'Qt5AccessibleWidget::attributes' had returned "font-family:;font-size:0pt;font-weight:normal;" and 'AtSpiAdaptor::getAttributes' (from the Qt library) aborts, since it splits the "font-family:" part at the colon, then expects two substrings: one for the attribute name, one for the value - but there was no value set: QString joined = interface->textInterface()->attributes(offset, &startOffset, &endOffset); const QStringList attributes = joined.split (QLatin1Char(';'), Qt::SkipEmptyParts, Qt::CaseSensitive); for (const QString &attr : attributes) { QStringList items; items = attr.split(QLatin1Char(':'), Qt::SkipEmptyParts, Qt::CaseSensitive); -> AtSpiAttribute attribute = atspiTextAttribute(items[0], items[1]); if (!attribute.isNull()) set[attribute.name] = attribute.value; } The IAccessible2 spec for the "background-color" text attribute [1] doesn't specify any default value to be used. Backtrace: Thread 1 received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (rr) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007f4dcd0bd537 in __GI_abort () at abort.c:79 #2 0x00007f4dba7fd810 in qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) (context=..., message=...) at global/qlogging.cpp:1914 #3 0x00007f4dba7f9d48 in QMessageLogger::fatal(char const*, ...) const (this=0x7ffc30a4a6b0, msg=0x7f4dbab9ebb0 "ASSERT failure in %s: \"%s\", file %s, line %d") at global/qlogging.cpp:893 #4 0x00007f4dba7f1484 in qt_assert_x(char const*, char const*, char const*, int) (where=0x7f4db778eb36 "QList<T>::operator[]", what=0x7f4db778eac8 "index out of range", file=0x7f4db778ea90 "../../../include/QtCore/../../src/corelib/tools/qlist.h", line=579) at global/qglobal.cpp:3366 #5 0x00007f4db7736a65 in QList<QString>::operator[](int) (this=0x7ffc30a4a730, i=1) at ../../../include/QtCore/../../src/corelib/tools/qlist.h:579 #6 0x00007f4db773017e in AtSpiAdaptor::getAttributes(QAccessibleInterface*, int, bool) const (this=0x557748f27800, interface=0x7f4d8c07cc30, offset=9, includeDefaults=true) at atspiadaptor.cpp:2059 #7 0x00007f4db772cd74 in AtSpiAdaptor::textInterface(QAccessibleInterface*, QString const&, QDBusMessage const&, QDBusConnection const&) (this=0x557748f27800, interface=0x7f4d8c07cc30, function=..., message=..., connection=...) at atspiadaptor.cpp:1802 #8 0x00007f4db77274f8 in AtSpiAdaptor::handleMessage(QDBusMessage const&, QDBusConnection const&) (this=0x557748f27800, message=..., connection=...) at atspiadaptor.cpp:1286 #9 0x00007f4db7fe4d04 in QDBusConnectionPrivate::activateObject(QDBusConnectionPrivate::ObjectTreeNode&, QDBusMessage const&, int) (this=0x7f4d8c014b00, node=..., msg=..., pathStartPos=27) at qdbusintegrator.cpp:1458 #10 0x00007f4db7fe58ca in QDBusActivateObjectEvent::placeMetaCall(QObject*) (this=0x557753615310) at qdbusintegrator.cpp:1617 #11 0x00007f4dbaab3c66 in QObject::event(QEvent*) (this=0x557748f27800, e=0x557753615310) at kernel/qobject.cpp:1314 #12 0x00007f4db96be845 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=0x557747e30970, receiver=0x557748f27800, e=0x557753615310) at kernel/qapplication.cpp:3632 #13 0x00007f4db96bbcfb in QApplication::notify(QObject*, QEvent*) (this=0x557747f1d8b0, receiver=0x557748f27800, e=0x557753615310) at kernel/qapplication.cpp:2972 #14 0x00007f4dbaa70aba in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x557748f27800, event=0x557753615310) at kernel/qcoreapplication.cpp:1064 #15 0x00007f4dbaa71452 in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x557748f27800, event=0x557753615310) at kernel/qcoreapplication.cpp:1462 #16 0x00007f4dbaa7213a in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x557747eff460) at kernel/qcoreapplication.cpp:1821 #17 0x00007f4dbaa71acc in QCoreApplication::sendPostedEvents(QObject*, int) (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1680 #18 0x00007f4dbaaff079 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x557748056a30) at kernel/qeventdispatcher_glib.cpp:277 #19 0x00007f4dbfe4ce6b in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #20 0x00007f4dbfe4d118 in () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #21 0x00007f4dbfe4d1cf in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0 #22 0x00007f4dbaaff7a2 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x557748062a70, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #23 0x00007f4db76af8fc in QXcbGlibEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x557748062a70, flags=...) at qxcbeventdispatcher.cpp:143 #24 0x00007f4db9255353 in Qt5Instance::DoYield(bool, bool) (this=0x557747f22580, bWait=4, bHandleAllCurrentEvents=2) at .../libreoffice/vcl/qt5/Qt5Instance.cxx:400 #25 0x00007f4db9255465 in Qt5Instance::AnyInput(VclInputFlags) (this=0xd87f0c9bbde3ed00, nType=(VclInputFlags::PAINT | VclInputFlags::TIMER | VclInputFlags::OTHER | VclInputFlags::APPEVENT | unknown: 0x7fc0)) at .../libreoffice/vcl/qt5/Qt5Instance.cxx:422 #26 0x00007f4dc594b64a in ImplYield(bool, bool) (i_bWait=true, i_bAllEvents=false) at .../libreoffice/vcl/source/app/svapp.cxx:465 #27 0x00007f4dc594be0b in Application::Yield() () at .../libreoffice/vcl/source/app/svapp.cxx:532 #28 0x00007f4dc594b357 in Application::Execute() () at .../libreoffice/vcl/source/app/svapp.cxx:444 #29 0x00007f4dcd2c4226 in desktop::Desktop::Main() (this=0x7ffc30a4c540) at .../libreoffice/desktop/source/app/app.cxx:1602 #30 0x00007f4dc5967cc6 in ImplSVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:199 #31 0x00007f4dc5967de7 in SVMain() () at .../libreoffice/vcl/source/app/svmain.cxx:231 #32 0x00007f4dcd324e9f in soffice_main() () at .../libreoffice/desktop/source/app/sofficemain.cxx:98 #33 0x000055774613895d in sal_main () at .../libreoffice/desktop/source/app/main.c:49 #34 0x0000557746138943 in main (argc=2, argv=0x7ffc30a4c8b8) at .../libreoffice/desktop/source/app/main.c:47 [1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes Change-Id: I5e9d5121e69340ff728a87b4a6cb5c182d9ad11b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119247 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
- Loading branch information