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

Segmentation fault when using QML_SINGLETON with QAbstractListModel

    XMLWordPrintable

Details

    • Linux/X11
    • 4ab857c37b (qt/qtdeclarative/dev) 4ab857c37b (qt/tqtc-qtdeclarative/dev) b497f79de2 (qt/tqtc-qmlcompilerplus/6.2) b3e8a32e71 (qt/qtdeclarative/6.3) b3e8a32e71 (qt/tqtc-qtdeclarative/6.3)

    Description

      Applications using a QAbstractListModel that is registered with QML_SINGLETON to QML, crash with a segmentation fault since Qt 6.3, when the list model is used in QML and the QML is built as a proper cmake qml_module.

      This is a regression, since this worked perfectly fine in Qt 6.2.

       

      I have attached a complete minimal reproducable example in an archive, but here is the gist of it:

      // C++
      class SingletonModel : public QAbstractListModel {
      Q_OBJECT
      QML_ELEMENT
      QML_SINGLETON
      // ...
      }
      // QML
      import Backend
      
      ListView {
      model: SingletonModel
      delegate: Item {}
      }
      # cmake
      qt_add_qml_module(${PROJECT_NAME} URI "Backend" VERSION 1.0 QML_FILES "src/qml/main.qml" SOURCES "src/singleton_model.cpp")

       

      Below is a backtrace:

       

       

      #0  0x00007ffff74ca5df in ?? () from /usr/lib/libQt6Qml.so.6
      #1  0x00007ffff74d0933 in QJSValue::toVariant(QJSValue::ObjectConversionBehavior) const () from /usr/lib/libQt6Qml.so.6
      #2  0x0000555555561934 in QmlCacheGeneratedCode::_0x5f_Backend_src_qml_main_qml::aotBuiltFunctions::{lambda(QQmlPrivate::AOTCompiledContext const*, void*, QQmlPrivate::AOTCompiledContext const**)#2}::operator()(QQmlPrivate::AOTCompiledContext const, QQmlPrivate::AOTCompiledContext const*, void*) const::{lambda(QQmlPrivate::AOTCompiledContext const, void*)#1}::operator()(QQmlPrivate::AOTCompiledContext const, void*) const (__closure=0x7fffffffd4d7, aotContext=0x7fffffffd5a0, argumentsPtr=0x7fffffffd800)
          at /tmp/qml-singleton/build/.rcc/qmlcache/qml-singleton_src/qml/main_qml.cpp:320
      #3  0x0000555555561e9a in QmlCacheGeneratedCode::_0x5f_Backend_src_qml_main_qml::wrapCall<QmlCacheGeneratedCode::_0x5f_Backend_src_qml_main_qml::aotBuiltFunctions::{lambda(QQmlPrivate::AOTCompiledContext const*, void*, QQmlPrivate::AOTCompiledContext const**)#2}::operator()(QQmlPrivate::AOTCompiledContext const, QQmlPrivate::AOTCompiledContext const*, void*) const::{lambda(QQmlPrivate::AOTCompiledContext const, void*)#1}>(QQmlPrivate::AOTCompiledContext const, QQmlPrivate::AOTCompiledContext const*, void*, QmlCacheGeneratedCode::_0x5f_Backend_src_qml_main_qml::aotBuiltFunctions::{lambda(QQmlPrivate::AOTCompiledContext const*, void*, QQmlPrivate::AOTCompiledContext const**)#2}::operator()(QQmlPrivate::AOTCompiledContext const, QQmlPrivate::AOTCompiledContext const*, void*) const::{lambda(QQmlPrivate::AOTCompiledContext const, void*)#1}&&) (aotContext=0x7fffffffd5a0, dataPtr=0x7fffffffd7a0, argumentsPtr=0x7fffffffd800, binding=...) at /tmp/qml-singleton/build/.rcc/qmlcache/qml-singleton_src/qml/main_qml.cpp:265
      #4  0x00005555555619b9 in QmlCacheGeneratedCode::_0x5f_Backend_src_qml_main_qml::aotBuiltFunctions::{lambda(QQmlPrivate::AOTCompiledContext const*, void*, QQmlPrivate::AOTCompiledContext const**)#2}::operator()(QQmlPrivate::AOTCompiledContext const, QQmlPrivate::AOTCompiledContext const*, void*) const (__closure=0x0, aotContext=0x7fffffffd5a0, dataPtr=0x7fffffffd7a0, argumentsPtr=0x7fffffffd800) at /tmp/qml-singleton/build/.rcc/qmlcache/qml-singleton_src/qml/main_qml.cpp:300
      #5  0x00005555555619fd in QmlCacheGeneratedCode::_0x5f_Backend_src_qml_main_qml::aotBuiltFunctions::{lambda(QQmlPrivate::AOTCompiledContext const*, void*, QQmlPrivate::AOTCompiledContext const**)#2}::_FUN(QQmlPrivate::AOTCompiledContext const, QQmlPrivate::AOTCompiledContext const*, void*) () at /tmp/qml-singleton/build/.rcc/qmlcache/qml-singleton_src/qml/main_qml.cpp:323
      #6  0x00007ffff75a4310 in ?? () from /usr/lib/libQt6Qml.so.6
      #7  0x00007ffff7524ed6 in QV4::Function::call(QObject*, void**, QMetaType const*, int, QV4::ExecutionContext*) () from /usr/lib/libQt6Qml.so.6
      #8  0x00007ffff761c3ef in QQmlJavaScriptExpression::evaluate(void**, QMetaType const*, int) () from /usr/lib/libQt6Qml.so.6
      #9  0x00007ffff75c95a5 in ?? () from /usr/lib/libQt6Qml.so.6
      #10 0x00007ffff75c8cef in QQmlBinding::update(QFlags<QQmlPropertyData::WriteFlag>) () from /usr/lib/libQt6Qml.so.6
      #11 0x00007ffff763e8e5 in QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) () from /usr/lib/libQt6Qml.so.6
      #12 0x00007ffff75e09b4 in QQmlComponentPrivate::complete(QQmlEnginePrivate*, QQmlComponentPrivate::ConstructionState*) () from /usr/lib/libQt6Qml.so.6
      #13 0x00007ffff75e0c0f in QQmlComponentPrivate::completeCreate() () from /usr/lib/libQt6Qml.so.6
      #14 0x00007ffff75e0d05 in QQmlComponent::create(QQmlContext*) () from /usr/lib/libQt6Qml.so.6
      #15 0x00007ffff75c6cd3 in QQmlApplicationEnginePrivate::finishLoad(QQmlComponent*) () from /usr/lib/libQt6Qml.so.6
      #16 0x00007ffff75c85c1 in QQmlApplicationEngine::load(QUrl const&) () from /usr/lib/libQt6Qml.so.6
      #17 0x000055555555a1f3 in main (argc=1, argv=0x7fffffffdd88) at /tmp/qml-singleton/src/main.cpp:13
      

       

      Attachments

        Issue Links

          Activity

            People

              ulherman Ulf Hermann
              vimpostor Magnus Groß
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: