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

Regression in Qt 5.8 - QQmlEngine crashing when trying to clear the component cache and a QML Item reuses another QML Item as base

    XMLWordPrintable

Details

    Description

      While trying to reduce the code for this issue I observed that: when a QML Item(with a ListView - without it, it doesn't crash) is reusing another QML item as a base and a call is made to QML Engine's clearComponentCache, the QML Engine is crashing.

      This issue is not reproducible on: Qt 5.2.1, 5.5.0, 5.6.1, 5.7.0.
      It is reproducible on: Qt 5.8-alpha and Qt 5.8-beta.

      I attached the "shortened" code that can reproduce this issue.
      Note that it is flaky, you might need to run it 1-5 times until it hits the issue.
      When I had the entire code with more QML Items, it was crahing 100%.

      Also, I had an "Image" component in the ListView.
      Removing "Image" from ListView and ListModel made 2 other asserts to disappear.
      Before removing the "Image", the application would alternate between:

      • The crash reproducible here: QAtomicOps::load
      • Assert in QQmlRefCount::release after QAtomicOps::load returns. Q_ASSERT(refCount.load() > 0) - in -> void QQmlRefCount::release() (qqmlrefcount_p.h))
      • Assert in QArrayData. size == 0 || offset < 0 || size_t(offset) >= sizeof(QArrayData) from another cache->clear()/release().

      One common code-path hit by all 3 issues was the call to: QV4::ExecutionEngine::~ExecutionEngine -> QV4::CompileData::CompilationUnit::unlink

      I have compiled locally the Qt 5.8-beta. If you want, I am willing to try to apply patches and see on the bigger code-base if it is still reproducible(asserts included).

      When looking at the code, please pay attention to:

      • Crash.qml - there is a comment
      • viewer.cpp - line 80(with the line commented out, the issue is not reproducible)

      Attachments

        Activity

          People

            shausman Simon Hausmann
            lilian.moraru Lilian A. Moraru
            Votes:
            23 Vote for this issue
            Watchers:
            35 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: