I have a class, that inherits QAbstractListModel. It's instance (which created with dynamically with new operator) registered in qml with setContextProperty(). In Qml it uses with GridLayout and Repeater.
Problem arises, when i closed my program: i do it from qml with following code:
quitButton{
onClicked: {
application.close();
Qt.quit()
}
}
And the program crashes on
delete(instanceOfModelClass);
with access violation. I tried set QObject's parent for this instancies, set QQmlEngine::CppOwnership for this objects in engine, but it still doesn't work.
How i can fix that problem?
P.S. If i erased delete(instanceOfModelClass); line it will work, but, as i understood, there will be meamory leak.