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

QML ListView frequently causes crashes when resetting the model

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P1: Critical
    • None
    • 6.4.3, 6.5.0
    • None
    • macOS, Windows

    Description

      Problem

      We're seeing a lot of crashes when updating Lists since switching to Qt6 (happens at least with Qt 6.4.3 and Qt 6.5.0). It mostly happens either if a the result set of a QSqlQuery model is updated, or if another QAbstractListModel is completely reset.

      Most, but not all of the affected lists are backed by a derivative of QSqlQueryModel. For those, setting an empty query before setting another "real" query seems to help avoiding the problem, e. g.

      model->setQuery(QSqlQuery{});
      QSqlQuery newQuery{"some sql"};
      model->setQuery(newQuery);

      In the non QSqlQuery backed cases, it helped to set the ListView model in QML to null before updating the List also seems to avoid the crashes. The crashes look very similar to https://bugreports.qt.io/browse/QTBUG-34779, and the problems did not appear in Qt5 (or at least not this frequent).

      Example Stack Trace 

      0   QtQuick                                0x11525a272 QQuickItem::setParentItem(QQuickItem*) + 34
      1   QtQuick                                0x1154f042b 0x11520b000 + 3036203
      2   QtQuick                                0x1154fccc5 0x11520b000 + 3087557
      3   QtQuick                                0x1154ed699 0x11520b000 + 3024537
      4   QtQuick                                0x1154e752f 0x11520b000 + 2999599
      5   QtQuick                                0x1154ebd78 QQuickItemView::modelUpdated(QQmlChangeSet const&, bool) + 72
      6   QtCore                                 0x11862534a 0x118567000 + 779082
      7   QtQmlModels                            0x114113a42 QQmlInstanceModel::modelUpdated(QQmlChangeSet const&, bool) + 66
      8   QtQmlModels                            0x1141549e6 0x1140fb000 + 367078
      9   QtQmlModels                            0x11414b9f1 0x1140fb000 + 330225
      10  QtQmlModels                            0x11414c67b QQmlDelegateModel::_q_itemsInserted(int, int) + 315
      11  QtQmlModels                            0x11415ec30 0x1140fb000 + 408624
      12  QtQmlModels                            0x11415f15d QQmlDelegateModel::qt_metacall(QMetaObject::Call, int, void**) + 141
      13  QtCore                                 0x11862505e 0x118567000 + 778334
      14  QtCore                                 0x1187f8b5c QAbstractItemModel::endInsertRows() + 220
      15  QtSql                                  0x11361a06f 0x113600000 + 106607
      16  QtQmlModels                            0x114145732 0x1140fb000 + 304946
      17  QtQmlModels                            0x1141550f5 QQmlDelegateModel::_q_modelReset() + 565
      18  QtQmlModels                            0x11415f15d QQmlDelegateModel::qt_metacall(QMetaObject::Call, int, void**) + 141
      19  QtCore                                 0x11862505e 0x118567000 + 778334
      20  QtCore                                 0x1187fa4f7 QAbstractItemModel::endResetModel() + 87
      21  QtSql                                  0x11361b446 QSqlQueryModel::setQuery(QSqlQuery&&) + 1254
      22  pascom Client                          0x102edfd35 0x1029a8000 + 5471541
      23  QtCore                                 0x118625085 0x118567000 + 778373
      24  QtCore                                 0x118625085 0x118567000 + 778373
      25  QtCore                                 0x11863ae5a QTimer::timerEvent(QTimerEvent*) + 202

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              santhoshkumar Santhosh Kumar Selvaraj
              jan.lorenz Jan Lorenz
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes