TypeError on closing window
Unsolved
QML and Qt Quick
-
Hi All,
Testing on windows [MSVC 19] with Qt 5.15.
I've made a simple application to explain the problem: https://github.com/motters/QtSetContextProperty open the project in QtCreator and run.
Essentially I'm using "setContextProperty" to map across a C++ object to QML. See Test class here.
Test vars; vars.count(1); engine.rootContext()->setContextProperty("Test", &vars);
I'm referencing the object in QLM as such
Window { id: window visible: true width: 640 height: 480 title: Test.count ...
This works perfectly fine on application boot & run, the data is mapped across as expected. However, when i close the application I get the following error:
qrc:/main.qml:10: TypeError: Cannot read property 'count' of null
Is there something I'm missing here? It's like QML is trying to access the Test object after it was deleted on exit.
Thanks,
Sam