Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
5.0.0
-
None
Description
The following Code throws the error message "invalid attempt to destroy() an indestructible object":
import QtQuick 2.0 Rectangle { id: appWindow width: 320; height: 480 Rectangle{ id: contentArea function initialize() { var rectangles = new Array(4); var c = Qt.createComponent("local.qml"); if (c.status == Component.Ready) { rectangles[0] = c.createObject(contentArea); console.log(c.createObject(contentArea)); rectangles[0].height = 400; rectangles[0].width = 320; rectangles[0].visible = false; } rectangles[0].destroy(); } width: parent.width height: parent.height - 60 x: 0; y: 60 color: "#00000f" Component.onCompleted: { console.log("EVENT:onCompleted") contentArea.initialize(); contentInteractionArea.drag.target = contentArea.rectangles[0]; drag.axis = Drag.XAxis; } MouseArea{ id: contentInteractionArea anchors.fill: parent z: 100 onClicked: {} } } }
Content of local.qml:
import QtQuick 2.0 Rectangle{ id: rect color: "#ff00ff" property string name: "rect" }
Works fine under Qt 4
Attachments
Issue Links
- duplicates
-
QTBUG-20626 [Regression] destroy() doesn't work on objects created dynamically in QML/JS.
-
- Closed
-
- relates to
-
QTBUG-10328 Error when calling destroy() in 'dynamic' example
-
- Closed
-
For Gerrit Dashboard: QTBUG-20513 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
2239,3 | Ensure that ownership semantics are enforced correctly | master | qt/qtdeclarative | Status: ABANDONED | +1 | 0 |