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

DelegateModelGroup crashes on insert

    XMLWordPrintable

Details

    • All
    • e8ba9a3caa (qt/qtdeclarative/dev) e8ba9a3caa (qt/tqtc-qtdeclarative/dev) 7810d632aa (qt/qtdeclarative/6.3) 7810d632aa (qt/tqtc-qtdeclarative/6.3) 7810d632aa (qt/tqtc-qtdeclarative/6.3.1) b13b954014 (qt/tqtc-qtdeclarative/6.2)

    Description

      While porting an application to 6.x, we found a couple of places where we just do something like

      flatItemsList.forEach(item => {
          if (item !== null) {
              items.insert(item, "available")
          }
      })

      on a DelegateModelGroup. This works for the first, sometimes the second loop run, then it crashes due to an invalid cacheItem pointer:

      1   QQmlDelegateModelPrivate::object                                                                            qqmldelegatemodel.cpp       1258 0x7ffff7239cd0 
      2   QQuickRepeater::modelUpdated                                                                                qquickrepeater.cpp          516  0x7ffff7723880 
      3   QQuickRepeater::qt_metacall                                                                                 moc_qquickrepeater_p.cpp    270  0x7ffff772455f 
      4   doActivate<false>                                                                                           qobject.cpp                 3940 0x7ffff5185bed 
      5   QMetaObject::activate                                                                                       qobject.cpp                 3974 0x7ffff517e330 
      6   QQmlInstanceModel::modelUpdated                                                                             moc_qqmlobjectmodel_p.cpp   260  0x7ffff71f6306 
      7   non-virtual thunk to QQmlDelegateModelPrivate::emitModelUpdated(QQmlChangeSet const&, bool)                 qvariant.h                  236  0x7ffff7230528 
      8   QQmlDelegateModelGroupPrivate::emitModelUpdated                                                             qqmldelegatemodel.cpp       2822 0x7ffff7232b73 
      9   QQmlDelegateModelPrivate::emitChanges                                                                       qqmldelegatemodel.cpp       1890 0x7ffff72365e8 
      10  QQmlDelegateModelGroup::insert                                                                              qqmldelegatemodel.cpp       3115 0x7ffff723d5fe 
      11  QQmlDelegateModelGroup::qt_metacall                                                                         moc_qqmldelegatemodel_p.cpp 644  0x7ffff72445ef 
      12  QQmlObjectOrGadget::metacall                                                                                qqmlobjectorgadget.cpp      50   0x7ffff5b8e0dd 
      13  operator()                                                                                                  qv4qobjectwrapper.cpp       2338 0x7ffff5a76e8c 
      14  operator()<QV4::QObjectMethod::callInternal(const QV4::Value *, const QV4::Value *, int) const::<lambda()>> qv4qobjectwrapper.cpp       2322 0x7ffff5a76e8c 
      15  QV4::QObjectMethod::callInternal                                                                            qv4qobjectwrapper.cpp       2332 0x7ffff5a76e8c 
      16  QV4::FunctionObject::call                                                                                   qv4functionobject_p.h       175  0x7ffff5aca580 
      17  QV4::Moth::VME::interpret                                                                                   qv4vme_moth.cpp             875  0x7ffff5aca580 
      18  QV4::Moth::VME::exec                                                                                        qv4vme_moth.cpp             557  0x7ffff5acdf29 
      19  QV4::ArrowFunction::virtualCall                                                                             qv4functionobject.cpp       578  0x7ffff5a2c498 
      20  QV4::FunctionObject::call                                                                                   qv4functionobject_p.h       205  0x7ffff59d4218 
      ... <more>                                                                                                                                                      
      

      The attached minimum example does not reproduce it 1:1, but crashes at a couple of calls earlier for a similar reason (invalid cacheItem) directly on startup.

      Attachments

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

        Activity

          People

            laknoll Lars Knoll
            cajus Cajus Pollmeier
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes