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

Crash in QtQuick compiler generated code with C++ type

    XMLWordPrintable

    Details

    • Platform/s:
      macOS
    • Commits:
      3747c02fe64fbf5496dc540402dddadb1fa33c12

      Description

      This simple example crashes in the QtQuick Compiler Code from 6.3.0 alpha. Complete example is attached.

      Stacktrace:

      1  QV4::Value::isString() const                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         qv4value_p.h                 371  0x10081d98c 
      2  QJSValue::toVariant(QJSValue::ObjectConversionBehavior) const                                                                                                                                                                                                                                                                                                                                                                                                                                                                        qjsvalue.cpp                 636  0x10081d985 
      3  QmlCacheGeneratedCode::_com_mycompany_foo_main_qml::$_0::operator()(QQmlPrivate::AOTCompiledContext const *, void *, void * *) const::'lambda'(QQmlPrivate::AOTCompiledContext const *, void * *)::operator()(QQmlPrivate::AOTCompiledContext const *, void * *) const                                                                                                                                                                                                                                                               appuntitled7_main_qml.cpp    288  0x10000ff31 
      4  void QmlCacheGeneratedCode::_com_mycompany_foo_main_qml::wrapCall<QmlCacheGeneratedCode::_com_mycompany_foo_main_qml::$_0::operator()(QQmlPrivate::AOTCompiledContext const *, void *, void * *) const::'lambda'(QQmlPrivate::AOTCompiledContext const *, void * *)>(QQmlPrivate::AOTCompiledContext const *, void *, void * *, QmlCacheGeneratedCode::_com_mycompany_foo_main_qml::$_0::operator()(QQmlPrivate::AOTCompiledContext const *, void *, void * *) const::'lambda'(QQmlPrivate::AOTCompiledContext const *, void * *)&&) appuntitled7_main_qml.cpp    258  0x10000fd86 
      5  QmlCacheGeneratedCode::_com_mycompany_foo_main_qml::$_0::operator()(QQmlPrivate::AOTCompiledContext const *, void *, void * *) const                                                                                                                                                                                                                                                                                                                                                                                                 appuntitled7_main_qml.cpp    267  0x10000fd2d 
      6  QmlCacheGeneratedCode::_com_mycompany_foo_main_qml::$_0::__invoke(QQmlPrivate::AOTCompiledContext const *, void *, void * *)                                                                                                                                                                                                                                                                                                                                                                                                         appuntitled7_main_qml.cpp    266  0x10000f855 
      7  QV4::Moth::VME::exec(QV4::MetaTypesStackFrame *, QV4::ExecutionEngine *)                                                                                                                                                                                                                                                                                                                                                                                                                                                             qv4vme_moth.cpp              490  0x10090efe6 
      8  QV4::Function::call(QObject *, void * *, QMetaType const *, int, QV4::ExecutionContext *)                                                                                                                                                                                                                                                                                                                                                                                                                                            qv4function.cpp              75   0x10087b0c3 
      9  QQmlJavaScriptExpression::evaluate(void * *, QMetaType const *, int)                                                                                                                                                                                                                                                                                                                                                                                                                                                                 qqmljavascriptexpression.cpp 306  0x10099ba70 
      10 QQmlBinding::evaluate(void *, QMetaType)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             qqmlbinding_p.h              155  0x100948e66 
      11 QQmlNonbindingBinding::doUpdate(QQmlJavaScriptExpression::DeleteWatcher const&, QFlags<QQmlPropertyData::WriteFlag>, QV4::Scope&)                                                                                                                                                                                                                                                                                                                                                                                                    qqmlbinding.cpp              265  0x100948e5c 
      12 QQmlBinding::update(QFlags<QQmlPropertyData::WriteFlag>)                                                                                                                                                                                                                                                                                                                                                                                                                                                                             qqmlbinding.cpp              199  0x100943ebb 
      13 QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&)                                                                                                                                                                                                                                                                                                                                                                                                                                                                             qqmlobjectcreator.cpp        1397 0x1009c9fd8 
      14 QQmlComponentPrivate::complete(QQmlEnginePrivate *, QQmlComponentPrivate::ConstructionState *)                                                                                                                                                                                                                                                                                                                                                                                                                                       qqmlcomponent.cpp            1042 0x10095baac 
      15 QQmlComponentPrivate::completeCreate()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               qqmlcomponent.cpp            1136 0x100959175 
      16 QQmlComponent::create(QQmlContext *)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 qqmlcomponent.cpp            863  0x10095aa34 
      17 QQmlApplicationEnginePrivate::finishLoad(QQmlComponent *)                                                                                                                                                                                                                                                                                                                                                                                                                                                                            qqmlapplicationengine.cpp    155  0x100941d3d 
      18 QQmlApplicationEnginePrivate::startLoad(QUrl const&, QByteArray const&, bool)                                                                                                                                                                                                                                                                                                                                                                                                                                                        qqmlapplicationengine.cpp    139  0x100941cb1 
      19 QQmlApplicationEngine::load(QUrl const&)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             qqmlapplicationengine.cpp    292  0x100942296 
      20 main                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 main.cpp                     16   0x1000061a0 
      

      A C++ Model:

      #ifndef SAMPLEMODEL_H
      #define SAMPLEMODEL_H
      
      #include <QAbstractListModel>
      #include <qqml.h>
      
      class SampleModel : public QAbstractListModel
      {
        Q_OBJECT
        QML_ELEMENT
      
        enum Roles {
          RoleFoo
        };
      
      public:
        explicit SampleModel(QObject *parent = nullptr);
      
        // QAbstractItemModel interface
      public:
        int rowCount(const QModelIndex &parent) const override;
        QVariant data(const QModelIndex &index, int role) const override;
        QHash<int, QByteArray> roleNames() const override;
      };
      
      #endif // SAMPLEMODEL_H
      

      Simple Qml example that uses this model:

      import QtQuick
      
      import com.mycompany.foo
      
      Window {
        width: 640
        height: 480
        visible: true
        title: qsTr("Hello World")
      
        SampleModel {
          id: sampleModel
        }
      
        Column {
          Repeater {
            model: sampleModel
      
            delegate: Text {
              required property string foo
      
              text: foo
            }
          }
        }
      }
      

      cmake:

      qt_add_qml_module(appuntitled7
          URI com.mycompany.foo
          VERSION 1.0
          QML_FILES main.qml
          # NO_CACHEGEN # does not crash when skipping qtquickcompiler
          SOURCES samplemodel.h samplemodel.cpp
      )
      

        Attachments

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

          Activity

            People

            Assignee:
            ulherman Ulf Hermann
            Reporter:
            njeisecke Nils Jeisecke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes