Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-140467

a11y: Assert hit when using AT-SPI Text's GetTextBeforeOffset in QLineEdit

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.11.0 FF
    • None
    • Debian testing, qtbase self-compiled from git dev as of 897034bc9361ae776de9dfb615af24daffaf3778
    • Linux/Wayland, Linux/X11

      The QAccessibleTextInterface::textBeforeOffset implementation used in the case of QLineEdit hits an assert with some valid indices passed, like the following example.

      Sample steps to reproduce:

      1. compile and run this sample program on Linux
        #include <QApplication>
        #include <QLineEdit>
        #include <QMainWindow>
        #include <QTextEdit>
        #include <QVBoxLayout>int main(int argc, char* argv[])
        {
            QApplication a(argc, argv);
            QMainWindow w;    QWidget* widget = new QWidget;
            w.setCentralWidget(widget);    QVBoxLayout* layout = new QVBoxLayout(widget);    layout->addWidget(new QLineEdit);
            layout->addWidget(new QTextEdit);    w.show();
            return a.exec();
        } 
      1. type "hello" in the QLineEdit
      2. start Accerciser Accessibility Explorer ( https://gitlab.gnome.org/GNOME/accerciser )
      3. in Accerciser's treeview of the sample program's a11y hierarchy, select the object for the QLineEdit
      4. in Accerciser's IPython console, try to get the word before the index 1
        In [1]: acc.queryText().getTextBeforeOffset(1, 1)
        ---------------------------------------------------------------------------
        Error                                     Traceback (most recent call last)
        Cell In[1], line 1
        ----> 1 acc.queryText().getTextBeforeOffset(1, 1)File /usr/lib/python3/dist-packages/pyatspi/text.py:497, in Text.getTextBeforeOffset(self, offset, type)
            472 def getTextBeforeOffset(self, offset, type):
            473         """
            474         Deprecated in favor of getStringAtOffset.
            475         Obtain a subset of the text content of an object which entirely
           (...)
            495         the object, delimited by the specified boundary condition.
            496         """
        --> 497         ret = Atspi.Text.get_text_before_offset(self.obj, offset, type)
            498         return textRangeToList(ret)Error: atspi_error: Message recipient disconnected from message bus without replying (1)

      Actual Result:

      Exception/Error shown in Accerciser.

      The program crashes/hits an assert:

      qt.accessibility.atspi: AtSpiAdaptor::applicationInterface does not implement "GetApplicationBusAddress" "/org/a11y/atspi/accessible/root"
      ASSERT: "boundary.position() >= 0" in file /home/michi/development/git/qt5/qtbase/src/gui/accessible/qaccessible.cpp, line 2282 

      Expected result:

      No assert hit. Since there is no word before index 1, an empty string and corresponding indices should be returned) instead.

        For Gerrit Dashboard: QTBUG-140467
        # Subject Branch Project Status CR V

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            michaelweghorn Michael Weghorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There is 1 open Gerrit change