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

Crash when importing style without first importing Controls

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.0, 6.1.0 RC
    • 6.0
    • Quick: Controls 2
    • None
    • 6147b56c03a89bf8f3bfd88fc4838718e06ecb48 (qt/qtquickcontrols2/dev)

    Description

      The following code

      import QtQuick
      import QtQuick.Controls.Material
      
      ApplicationWindow {
          width: 200
          height: 200
          visible: true
      }
      

      would produce an error in Qt 5:

      QQmlApplicationEngine failed to load component
      qrc:/main.qml:4 ApplicationWindow is not a type
      

      In Qt 6, after the changes for QTBUG-82922, it now crashes:

      14:28:18: Starting /home/mitch/dev/temp/quick-qt_dev_debug-Debug/quick ...
      QML debugging is enabled. Only use this in a safe environment.
      ASAN:DEADLYSIGNAL
      =================================================================
      ==10625==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f74c2de287f bp 0x7f74c9264e80 sp 0x7f74c9264e70 T4)
      ==10625==The signal is caused by a READ memory access.
      ==10625==Hint: address points to the zero page.
          #0 0x7f74c2de287e in QScopedPointer<QQuickThemePrivate, QScopedPointerDeleter<QQuickThemePrivate> >::get() const /home/mitch/dev/qt-dev-debug/qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/tools/qscopedpointer.h:145
          #1 0x7f74c2de1c01 in decltype (({parm#1}.get)()) qGetPtrHelper<QScopedPointer<QQuickThemePrivate, QScopedPointerDeleter<QQuickThemePrivate> > >(QScopedPointer<QQuickThemePrivate, QScopedPointerDeleter<QQuickThemePrivate> >&) /home/mitch/dev/qt-dev-debug/qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/global/qglobal.h:1105
          #2 0x7f74c2de1a93 in QQuickTheme::d_func() /home/mitch/dev/qt-dev/qtquickcontrols2/src/quicktemplates2/qquicktheme_p.h:98
          #3 0x7f74c2de12ea in QQuickTheme::setFont(QQuickTheme::Scope, QFont const&) /home/mitch/dev/qt-dev/qtquickcontrols2/src/quicktemplates2/qquicktheme.cpp:167
          #4 0x7f74c38c00bd in QQuickMaterialTheme::initialize(QQuickTheme*) /home/mitch/dev/qt-dev/qtquickcontrols2/src/imports/controls/material/qquickmaterialtheme.cpp:78
          #5 0x7f74c38c0eee in QtQuickControls2MaterialStylePlugin::registerTypes(char const*) /home/mitch/dev/qt-dev/qtquickcontrols2/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp:75
          #6 0x7f74e0f13043 in QQmlMetaType::registerPluginTypes(QObject*, QString const&, QString const&, QString const&, QTypeRevision, QList<QQmlError>*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmlmetatype.cpp:808
          #7 0x7f74e105d1af in QQmlImportDatabase::importDynamicPlugin(QString const&, QString const&, QString const&, QTypeRevision, bool, QList<QQmlError>*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmlimport.cpp:2346
          #8 0x7f74e10476db in QQmlImportsPrivate::importExtension(QString const&, QString const&, QTypeRevision, QQmlImportDatabase*, QQmlTypeLoaderQmldirContent const&, QList<QQmlError>*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmlimport.cpp:1239
          #9 0x7f74e104fe51 in QQmlImportsPrivate::addLibraryImport(QString const&, QString const&, QTypeRevision, QString const&, QString const&, unsigned int, QQmlImportDatabase*, QList<QQmlError>*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmlimport.cpp:1613
          #10 0x7f74e1055a72 in QQmlImports::addLibraryImport(QQmlImportDatabase*, QString const&, QString const&, QTypeRevision, QString const&, QString const&, unsigned int, QList<QQmlError>*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmlimport.cpp:1875
          #11 0x7f74e0fb1f55 in QQmlTypeLoader::Blob::addImport(std::shared_ptr<QQmlTypeLoader::Blob::PendingImport>, unsigned int, QList<QQmlError>*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:596
          #12 0x7f74e0fb13df in QQmlTypeLoader::Blob::addImport(QV4::CompiledData::Import const*, unsigned int, QList<QQmlError>*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:569
          #13 0x7f74e0df08f9 in QQmlTypeData::continueLoadFromIR() /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmltypedata.cpp:702
          #14 0x7f74e0ded790 in QQmlTypeData::dataReceived(QQmlDataBlob::SourceCodeData const&) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmltypedata.cpp:601
          #15 0x7f74e0faf5cc in QQmlTypeLoader::setData(QQmlDataBlob*, QQmlDataBlob::SourceCodeData const&) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:447
          #16 0x7f74e0faf3c2 in QQmlTypeLoader::setData(QQmlDataBlob*, QString const&) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:437
          #17 0x7f74e0fadc58 in QQmlTypeLoader::loadThread(QQmlDataBlob*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:299
          #18 0x7f74e0e47697 in QQmlTypeLoaderThread::loadThread(QQmlDataBlob*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmltypeloaderthread.cpp:162
          #19 0x7f74e0e47df6 in void QQmlThread::callMethodInThread<QQmlDataBlob*, QQmlDataBlob*, QQmlTypeLoaderThread>(void (QQmlTypeLoaderThread::*)(QQmlDataBlob*), QQmlDataBlob* const&)::I::call(QQmlThread*) /home/mitch/dev/qt-dev-debug/qtbase/include/QtQml/6.0.0/QtQml/private/../../../../../../../qt-dev/qtdeclarative/src/qml/qml/ftw/qqmlthread_p.h:164
          #20 0x7f74e11da1ff in QQmlThreadPrivate::threadEvent() /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:198
          #21 0x7f74e11d9cd5 in QQmlThreadPrivate::event(QEvent*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:142
          #22 0x7f74df73e0ef in QCoreApplicationPrivate::notify_helper(QObject*, QEvent*) /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qcoreapplication.cpp:1204
          #23 0x7f74df73d87a in doNotify /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qcoreapplication.cpp:1133
          #24 0x7f74df73d751 in QCoreApplication::notify(QObject*, QEvent*) /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qcoreapplication.cpp:1119
          #25 0x7f74e2706c62 in QGuiApplication::notify(QObject*, QEvent*) /home/mitch/dev/qt-dev/qtbase/src/gui/kernel/qguiapplication.cpp:1888
          #26 0x7f74df73d579 in QCoreApplication::notifyInternal2(QObject*, QEvent*) /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qcoreapplication.cpp:1043
          #27 0x7f74df73ebf2 in QCoreApplication::sendEvent(QObject*, QEvent*) /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qcoreapplication.cpp:1438
          #28 0x7f74df741329 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qcoreapplication.cpp:1797
          #29 0x7f74df73fc5d in QCoreApplication::sendPostedEvents(QObject*, int) /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qcoreapplication.cpp:1656
          #30 0x7f74df8ce70e in postEventSourceDispatch /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:277
          #31 0x7f74dc416416 in g_main_context_dispatch (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4c416)
          #32 0x7f74dc41664f  (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4c64f)
          #33 0x7f74dc4166db in g_main_context_iteration (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x4c6db)
          #34 0x7f74df8cfcc7 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:423
          #35 0x7f74df73259f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qeventloop.cpp:139
          #36 0x7f74df732f34 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) /home/mitch/dev/qt-dev/qtbase/src/corelib/kernel/qeventloop.cpp:232
          #37 0x7f74df04e1b4 in QThread::exec() /home/mitch/dev/qt-dev/qtbase/src/corelib/thread/qthread.cpp:538
          #38 0x7f74e11d9dad in QQmlThreadPrivate::run() /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:155
          #39 0x7f74df054a6a in QThreadPrivate::start(void*) /home/mitch/dev/qt-dev/qtbase/src/corelib/thread/qthread_unix.cpp:329
          #40 0x7f74ddde56da in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76da)
          #41 0x7f74de52aa3e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x121a3e)
      
      AddressSanitizer can not provide additional info.
      SUMMARY: AddressSanitizer: SEGV /home/mitch/dev/qt-dev-debug/qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/tools/qscopedpointer.h:145 in QScopedPointer<QQuickThemePrivate, QScopedPointerDeleter<QQuickThemePrivate> >::get() const
      Thread T4 (QQmlThread) created by T0 here:
          #0 0x7f74e49b2d2f in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x37d2f)
          #1 0x7f74df0562a7 in QThread::start(QThread::Priority) /home/mitch/dev/qt-dev/qtbase/src/corelib/thread/qthread_unix.cpp:714
          #2 0x7f74e11da544 in QQmlThread::startup() /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/ftw/qqmlthread.cpp:234
          #3 0x7f74e0e46ea7 in QQmlTypeLoaderThread::QQmlTypeLoaderThread(QQmlTypeLoader*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmltypeloaderthread.cpp:57
          #4 0x7f74e0fb5676 in QQmlTypeLoader::QQmlTypeLoader(QQmlEngine*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmltypeloader.cpp:809
          #5 0x7f74e0e70306 in QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmlengine.cpp:627
          #6 0x7f74e10cf8b7 in QQmlApplicationEnginePrivate::QQmlApplicationEnginePrivate(QQmlEngine*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:51
          #7 0x7f74e10d22fe in QQmlApplicationEngine::QQmlApplicationEngine(QObject*) /home/mitch/dev/qt-dev/qtdeclarative/src/qml/qml/qqmlapplicationengine.cpp:232
          #8 0x55a6cd276e3c in main ../quick/main.cpp:60
          #9 0x7f74de42ab96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
      
      ==10625==ABORTING
      14:28:19: /home/mitch/dev/temp/quick-qt_dev_debug-Debug/quick exited with code 1
      

      We should instead inform the user to import QtQuick.Controls first.

      Attachments

        Issue Links

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

          Activity

            People

              mitch_curtis Mitch Curtis
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes