{
if (s == Ready) {
Q_ASSERT(QQmlData::get(object()));
- QQmlData::get(object())->setImplicitDestructible();
+ QQmlData::get(object())->explicitIndestructibleSet = false;
+ QQmlData::get(object())->indestructible = false;
}
if (!me.IsEmpty()) { // Will be false in synchronous mode
--- /dev/null
+import QtQuick 2.0
+
+Item {
+ id: root
+
+ property QtObject incubatedItem
+
+ Component.onCompleted: {
+ var component = Qt.createComponent("PropertyVarBaseItem.qml");
+
+ var incubator = component.incubateObject(root);
+ if (incubator.status != Component.Ready) {
+ incubator.onStatusChanged = function(status) {
+ if (status == Component.Ready) {
+ incubatedItem = incubator.object;
+ }
+ }
+ } else {
+ incubatedItem = incubator.object;
+ }
+ }
+
+ function deleteIncubatedItem() {
+ incubatedItem.destroy();
+ gc();
+ }
+}
void ownershipCustomReturnValue();
void ownershipRootObject();
void ownershipConsistency();
+ void ownershipQmlIncubated();
void qlistqobjectMethods();
void strictlyEquals();
void compiled();
delete object;
}
+void tst_qqmlecmascript::ownershipQmlIncubated()
+{
+ QQmlComponent component(&engine, testFileUrl("ownershipQmlIncubated.qml"));
+ QObject *object = component.create();
+ QVERIFY(object);
+
+ QTRY_VERIFY(object->property("incubatedItem").value<QObject*>() != 0);
+
+ QMetaObject::invokeMethod(object, "deleteIncubatedItem");
+
+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
+ QCoreApplication::processEvents();
+
+ QVERIFY(object->property("incubatedItem").value<QObject*>() == 0);
+
+ delete object;
+}
+
class QListQObjectMethodsObject : public QObject
{
Q_OBJECT