Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-6587

Crashes when opening a qml file with c++ module

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P0: Blocker
    • Qt Creator 2.4.0
    • Qt Creator 2.4.0
    • Quick / QML Support
    • None
    • Ubuntu 11.10 64 bit. Qtcreator based on 4.8.0-rc1 I'm seen a similar crash on window, and mac as well.
    • 2e724095c146b9f8bfe5f4594a6250b3cfb2bf11

    Description

      I currently have a project with c++ and qml. When I open qml file in the editor, qtcreator will crash. I think it do with importing my custom c++ module in qml? Anyways, the dynamic_cast in readModule() fails, returns null, and cause qtcreator to crash. I'm guessing member isn't a UiObjectDefinition, instead it appears to be a it's a UiScriptBinding. See below:

      I hope this is fixed before 2.4 release, because this bug is current preventing me from using 2.4.

      Backtrace

      0	QmlJS::TypeDescriptionReader::readModule	qmljstypedescriptionreader.cpp	148	0x7fffe1302b9f	
      1	QmlJS::TypeDescriptionReader::readDocument	qmljstypedescriptionreader.cpp	140	0x7fffe13029b4	
      2	QmlJS::TypeDescriptionReader::operator()	qmljstypedescriptionreader.cpp	79	0x7fffe130227a	
      3	QmlJS::CppQmlTypesLoader::parseQmlTypeDescriptions	qmljsinterpreter.cpp	1244	0x7fffe12cc1dd	
      4	parseHelper	qmljsplugindumper.cpp	267	0x7fffd9e3fdf4	
      5	QmlJSTools::Internal::PluginDumper::qmlPluginTypeDumpDone	qmljsplugindumper.cpp	298	0x7fffd9e40095	
      6	QmlJSTools::Internal::PluginDumper::qt_static_metacall	moc_qmljsplugindumper.cpp	71	0x7fffd9e58287	
      7	QMetaObject::activate(QObject*, QMetaObject const*, int, void**)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff67f8ef1	
      8	QProcess::finished(int)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff677aa01	
      9	??	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff67820b2	
      10	??	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff678214e	
      11	QMetaObject::activate(QObject*, QMetaObject const*, int, void**)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff67f8ef1	
      12	QSocketNotifier::activated(int)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff6845e3e	
      13	QSocketNotifier::event(QEvent*)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff680225b	
      14	QApplicationPrivate::notify_helper(QObject*, QEvent*)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtGui.so.4	0	0x7ffff7095a74	
      15	QApplication::notify(QObject*, QEvent*)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtGui.so.4	0	0x7ffff709a8f3	
      16	QCoreApplication::notifyInternal(QObject*, QEvent*)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff67e505c	
      17	??	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff68136d7	
      18	g_main_context_dispatch	/lib/x86_64-linux-gnu/libglib-2.0.so.0	0	0x7ffff58cfa5d	
      19	??	/lib/x86_64-linux-gnu/libglib-2.0.so.0	0	0x7ffff58d0258	
      20	g_main_context_iteration	/lib/x86_64-linux-gnu/libglib-2.0.so.0	0	0x7ffff58d0429	
      21	QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff68140e6	
      22	??	/usr/local/Trolltech/Qt-4.8.0/lib/libQtGui.so.4	0	0x7ffff7138ffe	
      23	QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff67e3e42	
      24	QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff67e4097	
      25	QCoreApplication::exec()	/usr/local/Trolltech/Qt-4.8.0/lib/libQtCore.so.4	0	0x7ffff67e8bf5	
      26	main	main.cpp	398	0x40a5c3	
      

      Failing code - readModule

      void TypeDescriptionReader::readModule(UiObjectDefinition *ast)
      {
          for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) {
              UiObjectMember *member = it->member;
              UiObjectDefinition *component = dynamic_cast<UiObjectDefinition *>(member);
              const QString typeName = Bind::toString(component->qualifiedTypeNameId);
              if (!component || (typeName != "Component" && typeName != "ModuleApi")) {
                  addWarning(member->firstSourceLocation(), "Expected only 'Component' and 'ModuleApi' object definitions");
                  continue;
              }
      
              if (typeName == QLatin1String("Component"))
                  readComponent(component);
          }
      }
      

      Data in readModule during crash

       	ast	 @0x1bc36c8	QmlJS::AST::UiObjectDefinition
      	component	0x0	QmlJS::AST::UiObjectDefinition *
      	it	 @0x1bc3370	QmlJS::AST::UiObjectMemberList
      	member	 @0x1bc3340	QmlJS::AST::UiScriptBinding
      		QmlJS::AST::UiObjectMember		QmlJS::AST::UiObjectMember
      			QmlJS::AST::Node		QmlJS::AST::Node
      		colonToken		QmlJS::AST::SourceLocation
      		qualifiedId	 @0x1bc32b0	QmlJS::AST::UiQualifiedId
      		statement	 @0x1bc3318	QmlJS::AST::ExpressionStatement
      	this	 @0x7fffffffd110	QmlJS::TypeDescriptionReader
      	typeName	<not accessible>	QString
      

      Attachments

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

        Activity

          People

            ckamm Christian Kamm
            vpicaver Philip Schuchardt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes