Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9
-
None
Description
As found in https://codereview.qt-project.org/#/c/180025/ and discussed in the workaround, an object that is in array will become "corrupt" when destroyed and then later accessed via that array.
import QtQuick 2.5 import QtQuick.Window 2.2 import QtQuick.Controls 2.0 Window { id: window visible: true width: 400 height: 400 property var obj property var collection: [] Component.onCompleted: { // create obj = Qt.createQmlObject("import QtQuick 2.0; Rectangle {}", this) collection[0] = Qt.createQmlObject("import QtQuick 2.0; Rectangle {}", this) // destroy obj.destroy() collection[0].destroy() } Timer { interval: 1000 repeat: true running: true onTriggered: { console.log(obj, collection[0]) } } }
Quoting mbrasser:
The output is: qml: null TypeError: Type error i.e. it appears we correctly set individual properties to null when the object is destroyed, but not members of an Array. Simon, is that expected?