Whether returned object from Qt.createComponent needs to be destroyed?
-
wrote on 10 Sept 2019, 13:25 last edited by Crawl.W
var component = Qt.createComponent("SplashScreen.qml"); var obj = component.createObject(parent); if(obj === null) { obj.finished.connect(showHomePage); }
In the official example, no destroy.
-
var component = Qt.createComponent("SplashScreen.qml"); var obj = component.createObject(parent); if(obj === null) { obj.finished.connect(showHomePage); }
In the official example, no destroy.
wrote on 10 Sept 2019, 13:41 last edited by@crawl-w Hi,
Using
destroy()
. The doc ofcreateObject()
say:Dynamically created instances can be deleted with the destroy() method. See Dynamic QML Object Creation from JavaScript for more information.
-
@crawl-w Hi,
Using
destroy()
. The doc ofcreateObject()
say:Dynamically created instances can be deleted with the destroy() method. See Dynamic QML Object Creation from JavaScript for more information.
-
@gojir4 What you are saying is
obj
notcomponent
in the example code.obj
is instance ofcomponent
.wrote on 11 Sept 2019, 16:44 last edited byThis post is deleted! -
wrote on 11 Sept 2019, 18:34 last edited by FKosmale 9 Nov 2019, 20:54
The JavaScript engine will indeed take ownership of the object created by Qt.create
ComponentObject. This is not documented specifically because in general, any object returned by a JavaScript function is normally managed by the garbage collector. -
The JavaScript engine will indeed take ownership of the object created by Qt.create
ComponentObject. This is not documented specifically because in general, any object returned by a JavaScript function is normally managed by the garbage collector.wrote on 12 Sept 2019, 01:38 last edited by Crawl.WThis post is deleted!
1/6