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

Crash in theme code when loading engines in succession

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.0 RC
    • 5.6.0 Alpha
    • Quick: Controls 2
    • None
    • 2f902694656d67d671d9a8616060d598a478e7b7

    Description

      I'm seeing a crash in https://codereview.qt-project.org/#/c/123948/ when running the second test:

      0	QSharedDataPointer<QQuickThemeData::Data>::QSharedDataPointer	qshareddata.h	86	0x7fffec582c44	
      1	QQuickThemeData::QQuickThemeData	qquickthemedata_p.h	57	0x7fffec582405	
      2	QQuickThemeAttachedPrivate::QQuickThemeAttachedPrivate	qquicktheme.cpp	212	0x7fffec5824a1	
      3	QQuickThemeAttached::QQuickThemeAttached	qquicktheme.cpp	450	0x7fffec580ca9	
      4	QQuickThemeAttached::qmlAttachedProperties	qquicktheme.cpp	473	0x7fffec580e8b	
      5	QQmlPrivate::AttachedPropertySelector<QQuickThemeAttached, 1>::attachedProperties	qqmlprivate.h	172	0x7fffec57f195	
      6	QtQml::qmlAttachedPropertiesObjectById	qqmlengine.cpp	1441	0x7ffff6ddc8ea	
      7	QV4::QmlTypeWrapper::get	qqmltypewrapper.cpp	188	0x7ffff6e7e3bd	
      8	QV4::Object::get	qv4object_p.h	287	0x7ffff6c7be49	
      9	QV4::Runtime::getProperty	qv4runtime.cpp	675	0x7ffff6dba941	
      10	QV4::Moth::VME::run	qv4vme_moth.cpp	488	0x7ffff6da5cbb	
      11	QV4::Moth::VME::exec	qv4vme_moth.cpp	960	0x7ffff6daa88c	
      12	QV4::ScriptFunction::call	qv4functionobject.cpp	466	0x7ffff6d38829	
      13	QV4::Object::call	qv4object_p.h	313	0x7ffff6c7bf84	
      14	QQmlJavaScriptExpression::evaluate	qqmljavascriptexpression.cpp	189	0x7ffff6e6d7eb	
      15	QQmlJavaScriptExpression::evaluate	qqmljavascriptexpression.cpp	149	0x7ffff6e6d4b0	
      16	QQmlBinding::update	qqmlbinding.cpp	187	0x7ffff6e7545c	
      17	QQmlBinding::setEnabled	qqmlbinding.cpp	412	0x7ffff6e76ae3	
      18	QQmlObjectCreator::finalize	qqmlobjectcreator.cpp	1173	0x7ffff6e869eb	
      19	QQmlComponentPrivate::complete	qqmlcomponent.cpp	912	0x7ffff6df7fa9	
      ...	<More>
      

      I figure it's a similar problem to the example below:

      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      
          {
              QQmlApplicationEngine engine;
              engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
          }
      
          QQmlApplicationEngine engine;
          engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
      
          return app.exec();
      }
      

      main.qml:

      import QtQuick 2.3
      import QtQuick.Window 2.2
      import Qt.labs.controls 1.0
      
      Window {
          visible: true
      
          Slider {
          }
      }
      
      0	QSharedDataPointer<QQuickThemeData::Data>::QSharedDataPointer	qshareddata.h	86	0x7fffec359c44	
      1	QQuickThemeData::QQuickThemeData	qquickthemedata_p.h	57	0x7fffec359405	
      2	QQuickThemeAttachedPrivate::QQuickThemeAttachedPrivate	qquicktheme.cpp	212	0x7fffec3594a1	
      3	QQuickThemeAttached::QQuickThemeAttached	qquicktheme.cpp	450	0x7fffec357ca9	
      4	QQuickThemeAttached::qmlAttachedProperties	qquicktheme.cpp	473	0x7fffec357e8b	
      5	QQmlPrivate::AttachedPropertySelector<QQuickThemeAttached, 1>::attachedProperties	qqmlprivate.h	172	0x7fffec356195	
      6	QtQml::qmlAttachedPropertiesObjectById	qqmlengine.cpp	1441	0x7ffff736f8ea	
      7	QV4::QmlTypeWrapper::get	qqmltypewrapper.cpp	188	0x7ffff74113bd	
      8	QV4::Object::get	qv4object_p.h	287	0x7ffff720ee49	
      9	QV4::Runtime::getProperty	qv4runtime.cpp	675	0x7ffff734d941	
      10	QV4::Moth::VME::run	qv4vme_moth.cpp	488	0x7ffff7338cbb	
      11	QV4::Moth::VME::exec	qv4vme_moth.cpp	960	0x7ffff733d88c	
      12	QV4::ScriptFunction::call	qv4functionobject.cpp	466	0x7ffff72cb829	
      13	QV4::Object::call	qv4object_p.h	313	0x7ffff720ef84	
      14	QQmlJavaScriptExpression::evaluate	qqmljavascriptexpression.cpp	189	0x7ffff74007eb	
      15	QQmlJavaScriptExpression::evaluate	qqmljavascriptexpression.cpp	149	0x7ffff74004b0	
      16	QQmlBinding::update	qqmlbinding.cpp	187	0x7ffff740845c	
      17	QQmlBinding::setEnabled	qqmlbinding.cpp	412	0x7ffff7409ae3	
      18	QQmlObjectCreator::finalize	qqmlobjectcreator.cpp	1173	0x7ffff74199eb	
      19	QQmlComponentPrivate::complete	qqmlcomponent.cpp	912	0x7ffff738afa9	
      ...	<More>				
      

      Even though this example doesn't make much sense, I think that the root cause is the same between the two. The example above doesn't crash if it's pure Qt Quick.

      I suspect that it's something to do with the QQuickThemeData static global variable.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            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