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

Crash when expandAll is being called

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.0.0 Beta2, 5.15.0 RC2
    • Widgets: Itemviews
    • None

    Description

      Run the following code:

      static void populateModel(QStandardItemModel *model)
      {
          const int depth = 10;
          for (int i1 = 0; i1 < depth; ++i1) {
              QStandardItem *s1 = new QStandardItem;
              s1->setText(QString::number(i1));
              model->appendRow(s1);
              for (int i2 = 0; i2 < depth; ++i2) {
                  QStandardItem *s2 = new QStandardItem;
                  s2->setText(QStringLiteral("%1 - %2").arg(i1).arg(i2));
                  s1->appendRow(s2);
                  for (int i3 = 0; i3 < depth; ++i3) {
                      QStandardItem *s3 = new QStandardItem;
                      s3->setText(QStringLiteral("%1 - %2 - %3").arg(i1).arg(i2).arg(i3));
                      s2->appendRow(s3);
                  }
              }
          }
      }
      	
      void tst_QTreeView::expandTakeDeleteAndProcessEvents()
      {
          QStandardItemModel model;
          populateModel(&model);
          QTreeView view;
          view.setUniformRowHeights(true);
          view.setModel(&model);
          view.show();
          QVERIFY(QTest::qWaitForWindowExposed(&view));
      	
          view.expandAll();
          auto item = model.takeItem(0);
          QVERIFY(item);
          delete item;
          QApplication::processEvents();
      }
      

      It crashes on a call to processEvents():

      1  QList<QStandardItem *>::size                           qlist.h                   327  0x7ffff6e94b3c 
      2  QStandardItemPrivate::childIndex                       qstandarditemmodel_p.h    127  0x7ffff6e93fd0 
      3  QStandardItemPrivate::position                         qstandarditemmodel.cpp    95   0x7ffff6e8a404 
      4  QStandardItemModel::indexFromItem                      qstandarditemmodel.cpp    2334 0x7ffff6e8ed73 
      5  QStandardItemModel::parent                             qstandarditemmodel.cpp    2975 0x7ffff6e9030b 
      6  QModelIndex::parent                                    qabstractitemmodel.h      516  0x7ffff78e1202 
      7  QTreeView::drawRow                                     qtreeview.cpp             1651 0x7ffff7b86890 
      8  QTreeView::drawTree                                    qtreeview.cpp             1542 0x7ffff7b8625e 
      9  QTreeView::paintEvent                                  qtreeview.cpp             1349 0x7ffff7b8528b 
      10 QWidget::event                                         qwidget.cpp               8782 0x7ffff777b8ba 
      11 QFrame::event                                          qframe.cpp                550  0x7ffff7867095 
      12 QAbstractScrollArea::viewportEvent                     qabstractscrollarea.cpp   1095 0x7ffff7862be8 
      13 QAbstractItemView::viewportEvent                       qabstractitemview.cpp     1760 0x7ffff7ad5867 
      14 QTreeView::viewportEvent                               qtreeview.cpp             1331 0x7ffff7b8515f 
      15 QAbstractScrollAreaPrivate::viewportEvent              qabstractscrollarea_p.h   110  0x7ffff7863fd3 
      16 QAbstractScrollAreaFilter::eventFilter                 qabstractscrollarea_p.h   121  0x7ffff78640a2 
      17 QCoreApplicationPrivate::sendThroughObjectEventFilters qcoreapplication.cpp      1166 0x7ffff61f82e6 
      18 QApplicationPrivate::notify_helper                     qapplication.cpp          3385 0x7ffff7701766 
      19 QApplication::notify                                   qapplication.cpp          3341 0x7ffff770159a 
      20 QCoreApplication::notifyInternal2                      qcoreapplication.cpp      1040 0x7ffff61f7ec4 
      21 QCoreApplication::sendSpontaneousEvent                 qcoreapplication.cpp      1447 0x7ffff61f88a4 
      22 QWidgetPrivate::sendPaintEvent                         qwidget.cpp               5486 0x7ffff7771e34 
      23 QWidgetPrivate::drawWidget                             qwidget.cpp               5436 0x7ffff77719d5 
      24 QWidgetRepaintManager::paintAndFlush                   qwidgetrepaintmanager.cpp 1005 0x7ffff779ef8c 
      25 QWidgetRepaintManager::sync                            qwidgetrepaintmanager.cpp 772  0x7ffff779db77 
      26 QWidgetPrivate::syncBackingStore                       qwidget.cpp               1747 0x7ffff7766f23 
      27 QWidget::event                                         qwidget.cpp               8946 0x7ffff777c043 
      28 QFrame::event                                          qframe.cpp                550  0x7ffff7867095 
      29 QAbstractScrollArea::event                             qabstractscrollarea.cpp   1042 0x7ffff7862ab4 
      30 QAbstractItemView::event                               qabstractitemview.cpp     1688 0x7ffff7ad533d 
      31 QApplicationPrivate::notify_helper                     qapplication.cpp          3391 0x7ffff7701792 
      32 QApplication::notify                                   qapplication.cpp          3341 0x7ffff770159a 
      33 QCoreApplication::notifyInternal2                      qcoreapplication.cpp      1040 0x7ffff61f7ec4 
      34 QCoreApplication::sendEvent                            qcoreapplication.cpp      1435 0x7ffff61f8870 
      35 QCoreApplicationPrivate::sendPostedEvents              qcoreapplication.cpp      1794 0x7ffff61f9592 
      36 QCoreApplication::sendPostedEvents                     qcoreapplication.cpp      1653 0x7ffff61f8eea 
      37 postEventSourceDispatch                                qeventdispatcher_glib.cpp 277  0x7ffff65056f2 
      38 g_main_context_dispatch                                                               0x7ffff57cf7ef 
      39 g_main_context_iterate.constprop                                                      0x7ffff58215d8 
      40 g_main_context_iteration                                                              0x7ffff57ccbc3 
      41 QEventDispatcherGlib::processEvents                    qeventdispatcher_glib.cpp 427  0x7ffff6505f4a 
      42 QXcbGlibEventDispatcher::processEvents                 qxcbeventdispatcher.cpp   132  0x7fffe57f339c 
      43 QCoreApplication::processEvents                        qcoreapplication.cpp      1261 0x7ffff61f8466 
      44 tst_QTreeView::expandTakeDeleteAndProcessEvents        tst_qtreeview.cpp         5256 0x4650d8       
      45 tst_QTreeView::qt_static_metacall                      tst_qtreeview.moc         726  0x465c33       
      46 QMetaMethod::invoke                                    qmetaobject.cpp           2322 0x7ffff6210184 
      47 QMetaMethod::invoke                                    qmetaobject.h             125  0x7ffff689be08 
      48 QTest::TestMethods::invokeTestOnData                   qtestcase.cpp             934  0x7ffff6894a87 
      49 QTest::TestMethods::invokeTest                         qtestcase.cpp             1163 0x7ffff68955cb 
      50 QTest::TestMethods::invokeTests                        qtestcase.cpp             1506 0x7ffff689693f 
      51 QTest::qRun                                            qtestcase.cpp             1933 0x7ffff6897153 
      52 QTest::qExec                                           qtestcase.cpp             1841 0x7ffff6896c31 
      53 main                                                   tst_qtreeview.cpp         5259 0x4651ad       
      

      Crashes both in 5.15 and with 6.0.

      Please see: https://codereview.qt-project.org/c/qt/qtbase/+/325004

      Non of the proposed fixes for QTBUG-88966 fixes this one so far. That's why creating a separate ticket.

      Attachments

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

        Activity

          People

            laknoll Lars Knoll
            jkobus Jarek Kobus
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change