-
Bug
-
Resolution: Done
-
P1: Critical
-
4.7.1
-
None
QDeclarativeView::setObjectOwnership doesn't work as expected.
In essence, I have a
Q_INVOKABLE QObject *create() {
Object *o = new Object;
o->setObjectName("object x");
QDeclarativeEngine::setObjectOwnership(o, QDeclarativeEngine::CppOwnership);
return o;
}
Despite the ownership being set to CppOwnership, the above objects gets deleted by QML when create() is called in QML.
Testcase attached:
1. Click on the rect. You should see a message on console that an object got created.
2. Quit/Close the app. The view gets deleted on close. You will see messages from the Object destructor indicating that QML is deleting objects despite ownership being set to Cpp.
- relates to
-
QTBUG-15697 QDeclarativeEngine object ownership issues
-
- Closed
-