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

Crash in QML Javascript when setting a property from C++

XMLWordPrintable

      I have many crash in my Qt/QtQuick application in the QML javascript engine with the recent Qt version on MacOSX (5.5.0 Beta, 5.5.0 RC, 5.5.0 pre release).
      We use several QML engines (one per windows) which share some C++ objects. When there is a lot of activity in the application, mainly at startup when several windows may be opened almost at the same time, thus sharing actively C++ objects I see many crash like in the following trace :

      Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
      0 org.qt-project.QtQml 0x0000000105a77bcc QV4::Heap::String::append(QV4::Heap::String const*, QChar*) + 220
      1 org.qt-project.QtQml 0x0000000105a7783a QV4::Heap::String::simplifyString() const + 42
      2 org.qt-project.QtQml 0x0000000105a24779 QV4::Heap::StringObject::StringObject(QV4::ExecutionEngine*, QV4::Value const&) + 185
      3 org.qt-project.QtQml 0x00000001059d71de QV4::ExecutionEngine::newStringObject(QV4::Value const&) + 110
      4 org.qt-project.QtQml 0x0000000105a73d52 QV4::Runtime::getProperty(QV4::ExecutionEngine*, QV4::Value const&, int) + 610
      5 ??? 0x0000000111a540dc 0 + 4591010012
      6 org.qt-project.QtQml 0x0000000105a0ddc1 QV4::SimpleScriptFunction::call(QV4::Managed*, QV4::CallData*) + 577
      7 org.qt-project.QtQml 0x0000000105b044f9 QQmlJavaScriptExpression::evaluate(QQmlContextData*, QV4::Value const&, QV4::CallData*, bool*) + 601
      8 org.qt-project.QtQml 0x0000000105b04289 QQmlJavaScriptExpression::evaluate(QQmlContextData*, QV4::Value const&, bool*) + 121
      9 org.qt-project.QtQml 0x0000000105b0adee QQmlBinding::update(QFlags<QQmlPropertyPrivate::WriteFlag>) + 974
      10 org.qt-project.QtQml 0x0000000105b1a123 QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) + 339
      11 org.qt-project.QtQml 0x0000000105aa5790 QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt&) + 1280
      12 org.qt-project.QtQml 0x0000000105aa5143 QQmlEnginePrivate::incubate(QQmlIncubator&, QQmlContextData*) + 451
      13 org.qt-project.QtQml 0x0000000105aa2acf QQmlComponent::create(QQmlIncubator&, QQmlContext*, QQmlContext*) + 495
      14 org.qt-project.QtQuick 0x0000000104a429f2 QQuickLoaderPrivate::_q_sourceLoaded() + 578
      15 org.qt-project.QtQuick 0x0000000104a42229 QQuickLoaderPrivate::load() + 233
      16 org.qt-project.QtQuick 0x0000000104a436c3 QQuickLoader::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 787
      17 org.qt-project.QtQuick 0x0000000104a439f7 QQuickLoader::qt_metacall(QMetaObject::Call, int, void**) + 71
      18 org.qt-project.QtQml 0x0000000105a8555e QQmlVMEMetaObject::metaCall(QMetaObject::Call, int, void**) + 5854
      19 org.qt-project.QtCore 0x00000001054caad3 QMetaProperty::write(QObject*, QVariant const&) const + 1331
      20 org.qt-project.QtCore 0x00000001054eef7f QObject::setProperty(char const*, QVariant const&) + 111
      21 com.yourcompany.OpenTouchConversation 0x0000000102e22bd7 WindowOTC::reLoadQML() + 2455
      22 com.yourcompany.OpenTouchConversation 0x0000000102e211fe WindowOTC::loadQMLOnce() + 46
      23 com.yourcompany.OpenTouchConversation 0x0000000102fa0f39 WindowComCard::init(QSharedPointer<Conversation>) + 1593
      24 com.yourcompany.OpenTouchConversation 0x0000000102f9c457 WindowsConversationPool::getNew(QSharedPointer<Conversation>, WindowsConversationPool::WindowType) + 2295
      25 com.yourcompany.OpenTouchConversation 0x0000000102e14c22 WindowsMgr::openComCard(QSharedPointer<Conversation>, bool) + 1874
      26 com.yourcompany.OpenTouchConversation 0x0000000102e1a0a8 WindowsMgr::onWindowAutoCloseDelayExpired() + 1128
      27 com.yourcompany.OpenTouchConversation 0x000000010322612c WindowsMgr::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 140
      28 org.qt-project.QtCore 0x00000001054eeb82 QMetaObject::activate(QObject*, int, int, void**) + 2994
      29 com.yourcompany.OpenTouchConversation 0x0000000103227ae5 WindowOTC::windowAutoCloseDelayExpired() + 37
      30 com.yourcompany.OpenTouchConversation 0x0000000102e20fc5 WindowOTC::onAutoCloseDelayExpired() + 21
      31 com.yourcompany.OpenTouchConversation 0x000000010322682c WindowOTC::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 972
      32 org.qt-project.QtCore 0x00000001054eeb82 QMetaObject::activate(QObject*, int, int, void**) + 2994
      33 org.qt-project.QtCore 0x00000001054e7490 QObject::event(QEvent*) + 48
      34 org.qt-project.QtWidgets 0x0000000105f916fb QApplicationPrivate::notify_helper(QObject*, QEvent*) + 251
      35 org.qt-project.QtWidgets 0x0000000105f94ade QApplication::notify(QObject*, QEvent*) + 8318
      36 org.qt-project.QtCore 0x00000001054be1b3 QCoreApplication::notifyInternal(QObject*, QEvent*) + 115
      37 org.qt-project.QtCore 0x00000001055100c6 QTimerInfoList::activateTimers() + 1270
      38 libqcocoa.dylib 0x000000010b97bbe2 QCocoaEventDispatcherPrivate::activateTimersSourceCallback(void*) + 18
      39 com.apple.CoreFoundation 0x00007fff85299a01 _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 17
      40 com.apple.CoreFoundation 0x00007fff8528bb8d __CFRunLoopDoSources0 + 269
      41 com.apple.CoreFoundation 0x00007fff8528b1bf __CFRunLoopRun + 927
      42 com.apple.CoreFoundation 0x00007fff8528abd8 CFRunLoopRunSpecific + 296
      43 com.apple.HIToolbox 0x00007fff8d2aa56f RunCurrentEventLoopInMode + 235
      44 com.apple.HIToolbox 0x00007fff8d2aa2ea ReceiveNextEventCommon + 431
      45 com.apple.HIToolbox 0x00007fff8d2aa12b _BlockUntilNextEventMatchingListInModeWithFilter + 71
      46 com.apple.AppKit 0x00007fff88e119bb _DPSNextEvent + 978
      47 com.apple.AppKit 0x00007fff88e10f68 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 346
      48 com.apple.AppKit 0x00007fff88e06bf3 -[NSApplication run] + 594
      49 libqcocoa.dylib 0x000000010b97c7fd QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2189
      50 org.qt-project.QtCore 0x00000001054bb8cd QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 381
      51 org.qt-project.QtCore 0x00000001054be78a QCoreApplication::exec() + 346
      52 com.yourcompany.OpenTouchConversation 0x0000000102da3df5 main + 4741
      53 com.yourcompany.OpenTouchConversation 0x0000000102d8f384 start + 52

      The involved code is the following :

      if (!m_sourceQml.isEmpty()) {
      // Inject in the context the qml body
      LOG4CXX_TRACE(logger, "reLoadQML: windowAreaSource=" << m_sourceQml.toStdString());
      QQuickView::rootObject()->setProperty("windowAreaSource", RSRCPATH(m_sourceQml));

      This bug seems very similar to :
      https://bugreports.qt.io/browse/QTBUG-44895
      https://bugreports.qt.io/browse/QTBUG-45051
      which were closed without a fix going in Qt 5.5.0 if I'm right.

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

            Unassigned Unassigned
            vyskocil Vladimir Vyskocil
            Votes:
            5 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes