Changing view's model crashes at some point



  • Lets say I have a bunch of tabs and on tab index changed I change the model of a TreeView for the corresponding on in a map I have made in C++.

    What I have described works great, the issue is that after a little time switching around the tabs it crashes with this error: http://pastebin.com/m7j3b8NG

    Thank you for your help.



  • Nevermind I found a solution:

    QQmlApplicationEngine::setObjectOwnership(MY_OBJECT*, QQmlApplicationEngine::CppOwnership);
    

    It's important to set this whenever returning a pointer in a Q_INVOKABLE function or else it might get garbage collected apparently.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.