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

Valgrind reports read on deleted memory on the following code

    XMLWordPrintable

Details

    • 195b998175b629e6e915588e66991f74cffa4e48 (qtdeclarative)

    Description

      Valgrind says

      ==19211== Invalid read of size 8
      ==19211== at 0x58CA2C9: QRecursionWatcher<QQmlObjectCreatorSharedState, &QQmlObjectCreatorSharedState::recursionNode>::~QRecursionWatcher() (qrecursionwatcher_p.h:94)
      ==19211== by 0x58C8931: QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) (qqmlobjectcreator.cpp:1244)
      ==19211== by 0x583C938: QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt&) (qqmlincubator.cpp:357)
      ==19211== by 0x583BD7A: QQmlEnginePrivate::incubate(QQmlIncubator&, QQmlContextData*) (qqmlincubator.cpp:95)
      ==19211== by 0x5838A8F: QQmlComponent::create(QQmlIncubator&, QQmlContext*, QQmlContext*) (qqmlcomponent.cpp:1072)
      ==19211== by 0x5104805: QQuickLoaderPrivate::_q_sourceLoaded() (qquickloader.cpp:721)
      ==19211== by 0x5103F52: QQuickLoaderPrivate::load() (qquickloader.cpp:604)
      ==19211== by 0x5104A22: QQuickLoader::componentComplete() (qquickloader.cpp:813)
      ==19211== by 0x58C859C: QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) (qqmlobjectcreator.cpp:1202)
      ==19211== by 0x58384A1: QQmlComponentPrivate::complete(QQmlEnginePrivate*, QQmlComponentPrivate::ConstructionState*) (qqmlcomponent.cpp:932)
      ==19211== by 0x5838585: QQmlComponentPrivate::completeCreate() (qqmlcomponent.cpp:968)
      ==19211== by 0x5838537: QQmlComponent::completeCreate() (qqmlcomponent.cpp:961)
      ==19211== Address 0x214dff58 is 104 bytes inside a block of size 112 free'd
      ==19211== at 0x4C2C2BC: operator delete(void*) (vg_replace_malloc.c:503)
      ==19211== by 0x58C2095: QQmlObjectCreator::~QQmlObjectCreator() (qqmlobjectcreator.cpp:156)
      ==19211== by 0x583B64C: QScopedPointerDeleter<QQmlObjectCreator>::cleanup(QQmlObjectCreator*) (qscopedpointer.h:62)
      ==19211== by 0x583AE48: QScopedPointer<QQmlObjectCreator, QScopedPointerDeleter<QQmlObjectCreator> >::reset(QQmlObjectCreator*) (qscopedpointer.h:157)
      ==19211== by 0x583C321: QQmlIncubatorPrivate::clear() (qqmlincubator.cpp:185)
      ==19211== by 0x583CF3D: QQmlIncubator::clear() (qqmlincubator.cpp:577)
      ==19211== by 0x510324D: QQuickLoaderPrivate::clear() (qquickloader.cpp:95)
      ==19211== by 0x5103C01: QQuickLoader::setSourceComponent(QQmlComponent*) (qquickloader.cpp:472)
      ==19211== by 0x51055F6: QQuickLoader::qt_metacall(QMetaObject::Call, int, void**) (moc_qquickloader_p.cpp:280)
      ==19211== by 0x7244576: QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) (qmetaobject.cpp:308)
      ==19211== by 0x5832FD4: QQmlPropertyPrivate::write(QObject*, QQmlPropertyData const&, QVariant const&, QQmlContextData*, QFlags<QQmlPropertyPrivate::WriteFlag>) (qqmlproperty.cpp:1338)
      ==19211== by 0x58327BE: QQmlPropertyPrivate::writeValueProperty(QObject*, QQmlPropertyData const&, QVariant const&, QQmlContextData*, QFlags<QQmlPropertyPrivate::WriteFlag>) (qqmlproperty.cpp:1246)

      on the attached code.

      I know the code is a bit evil, but it's just a simplification of the real code we have were it kind of makes more sense.

      Attachments

        1. main.qml
          0.4 kB
          Albert Astals Cid (Canonical)
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            shausman Simon Hausmann
            tsdgeos_canonical Albert Astals Cid (Canonical) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes