Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Changing view's model crashes at some point
Qt 6.12 LTS is out! See what's new in the release blog

Changing view's model crashes at some point

Scheduled Pinned Locked Moved QML and Qt Quick
bugtreeviewlistviewcrash
2 Posts 1 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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.

    ? 1 Reply Last reply
    0
    • ? A Former User

      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.

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved