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

Adding an object with a null property in a nested object in an array crashes QQmlListModel::append

    XMLWordPrintable

Details

    • c3860cd04bbc089ef95bc441a1f8f1e46f9606f8 (qt/qtdeclarative/dev) 83100a84f2b0068b4cf725896bbb810415908334 (qt/qtdeclarative/5.15) c2ca14ce22551ea72544b6e2b3a19823b6dc3050 (qt/qtdeclarative/dev)

    Description

       

      Kind of hard to explain...

      I had some code working on 5.12.7 (using kromain 's JSONListModel), that crashes on 5.15.2 (also on 5.14.1 and 5.14.2, I happend to have those kits installed as well).

      I managed to slim down the issue, here's a snippet that makes Qml Engine crash :

      import QtQuick 2.0
      import QtQuick.Window 2.0
      
      Window {
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
          ListView {
              id: list1
              width: parent.width
              height: 200
      
              ListModel { id: listModel }
      
              model: listModel
      
              delegate: Component {
                  Text {
                      width: parent.width
                      horizontalAlignment: Text.AlignLeft
                      text: model.title
                  }
              }
          }
      
          Component.onCompleted: {
              listModel.append({"title": "item1"})
              listModel.append({"title": "item2", "sub":[null]})
              listModel.append({"title": "item3", "sub":[{"subItem":"subItem1"}]})
      
              //next one crashes :
              listModel.append({"title": "item4", "sub":[{"subItem":null}]})
          }
      }
      

      And here's the callstack :

      1  QQmlListModel::engine                    qqmllistmodel.cpp               2017 0x7ffa3c57bc9e 
      2  ListModel::set                           qqmllistmodel.cpp               706  0x7ffa3c5843da 
      3  ListModel::append                        qqmllistmodel.cpp               744  0x7ffa3c584602 
      4  ListModel::set                           qqmllistmodel.cpp               677  0x7ffa3c5840bf 
      5  ListModel::append                        qqmllistmodel.cpp               744  0x7ffa3c584602 
      6  QQmlListModel::append                    qqmllistmodel.cpp               2528 0x7ffa3c57a2ff 
      7  QQmlListModel::qt_static_metacall        moc_qqmllistmodel_p.cpp         145  0x7ffa3c578e5a 
      8  QQmlListModel::qt_metacall               moc_qqmllistmodel_p.cpp         231  0x7ffa3c578c8a 
      9  QMetaObject::metacall                    qmetaobject.cpp                 318  0x7ffa30b840b8 
      10 QQmlObjectOrGadget::metacall             qqmlobjectorgadget.cpp          52   0x7ffa16e7d6d0 
      11 QV4::QObjectMethod::callInternal         qv4qobjectwrapper.cpp           2127 0x7ffa16c1f919 
      12 QV4::QObjectMethod::virtualCall          qv4qobjectwrapper.cpp           2069 0x7ffa16c1f47b 
      13 QV4::FunctionObject::call                qv4functionobject_p.h           203  0x7ffa16a12eaf 
      14 QV4::Moth::VME::interpret                qv4vme_moth.cpp                 754  0x7ffa16c653e5 
      15 QV4::Moth::VME::exec                     qv4vme_moth.cpp                 463  0x7ffa16c61d45 
      16 QV4::Function::call                      qv4function.cpp                 69   0x7ffa16ba0774 
      17 QQmlJavaScriptExpression::evaluate       qqmljavascriptexpression.cpp    212  0x7ffa16eafcaf 
      18 QQmlBoundSignalExpression::evaluate      qqmlboundsignal.cpp             226  0x7ffa16e20601 
      19 QQmlBoundSignal_callback                 qqmlboundsignal.cpp             362  0x7ffa16e20d5a 
      20 QQmlNotifier::emitNotify                 qqmlnotifier.cpp                105  0x7ffa16e7c4ed 
      21 QQmlData::signalEmitted                  qqmlengine.cpp                  836  0x7ffa16de3219 
      22 doActivate<0>                            qobject.cpp                     3782 0x7ffa30be6426 
      23 QMetaObject::activate                    qobject.cpp                     3947 0x7ffa30bd36d7 
      24 QQmlComponentAttached::completed         moc_qqmlcomponentattached_p.cpp 149  0x7ffa16ff6f31 
      25 QQmlObjectCreator::finalize              qqmlobjectcreator.cpp           1444 0x7ffa16ed5f20 
      26 QQmlComponentPrivate::complete           qqmlcomponent.cpp               989  0x7ffa16e0cc40 
      27 QQmlComponentPrivate::completeCreate     qqmlcomponent.cpp               1080 0x7ffa16e0bb19 
      28 QQmlComponent::completeCreate            qqmlcomponent.cpp               1067 0x7ffa16e09b52 
      29 QQmlComponent::create                    qqmlcomponent.cpp               821  0x7ffa16e098de 
      30 QQmlApplicationEnginePrivate::finishLoad qqmlapplicationengine.cpp       148  0x7ffa16ec4ea6 
      31 QQmlApplicationEnginePrivate::startLoad  qqmlapplicationengine.cpp       133  0x7ffa16ec49c2 
      32 QQmlApplicationEngine::load              qqmlapplicationengine.cpp       279  0x7ffa16ec3ddd 
      33 main                                     main.cpp                        19   0x7ff6bc8429ce 
      34 invoke_main                              exe_common.inl                  79   0x7ff6bc844839 
      35 __scrt_common_main_seh                   exe_common.inl                  288  0x7ff6bc84471e 
      36 __scrt_common_main                       exe_common.inl                  331  0x7ff6bc8445de 
      37 mainCRTStartup                           exe_main.cpp                    17   0x7ff6bc8448c9 
      38 BaseThreadInitThunk                      KERNEL32                             0x7ffa78387c24 
      39 RtlUserThreadStart                       ntdll                                0x7ffa788ed4d1 
      
      

       

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            tryum Thibault Jochem
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes