02-12-2013 10:49 AM
We have encountered an issue with our dynamic qml components not getting deleted properly.
A Page is created dynamically, and populated by a number of Container objects that are created with createObject(this), setting the page as parent.
When the page is popped we call page.destroy() in onPopTransitionEnded, this should also delete all Container objects.
The container connect to a signal from a c++ component. It seems that this signal is not disconnected and the qml object somehow lingers in memory. The slot is called, but all of the properties are null, as if the Container is in some kind of limbo.
I have found a similar issue on StackOverflow:
http://stackoverflow.com/questions/8849031/dead-qm
However, i cannot find the onDestruction handler.
Any ideas how to disconnect the signals manually (or automatically)?
02-12-2013 10:53 AM
We've identified a similar (or identical) thing in pure QML.
For now, just ahead of my destroy() call, I've been doing this, with an appropriate routine provided in the Page (since I'm doing this only with Pages):
onPopTransitionEnded: {
try { page.disconnect_signals(); }
catch (error) {}
page.destroy();
}
Crude, but so far it's been effective. The disconnect_signals() routine simply mirrors any of my manual signalName.connect(someFunction) calls (usually done in onCreationCompleted) by doing signalName.disconnect(someFunction).
02-12-2013 10:55 AM - edited 02-12-2013 10:58 AM
that would be a bit bothersome, as we only delete the top object and rely on the tree for all the childen to be deleted ![]()
there is no slot that functions like onDestroyed?
02-14-2013 04:51 AM