Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPersistentModelIndex problems in debug libraries
Forum Updated to NodeBB v4.3 + New Features

QPersistentModelIndex problems in debug libraries

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.3k 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.
  • S Offline
    S Offline
    symphara
    wrote on last edited by
    #1

    Hello,

    I'm a developer in a fairy large desktop application using Qt 4.8 and I noticed a problem with removing rows from a model. As soon as a row is removed, the application crashes due to an assert in qabstractmodelindex.cpp:544, indicating a corruption in the persistent model indexes.

    We use a tree-like model (similar to a filesystem, with directories and files). The persistent model indexes are stored in data structures mirroring the Qt model. Each such data structure represents a node in the model and stores its persistent model index.

    Disabling (i.e. not setting) all the persistent indexes fixes the problem - but of course makes certain things more complicated, which is why I'd like to keep using them.

    Disabling (i.e. clearing) some of them, during or just before the row removal, doesn't fix the problem. I tried clearing: (1) the indexes affected by the row deletion (i.e. from the item being removed and following rows) (2) all the items from the parent having a row removed (3) the previous plus the parent's persistent index. No joy, still crashes, no idea why since the other indexes aren't affected at all.

    This happens even with the simplest case of removing the single row from a parent.

    Then I used the Qt Labs ModelTest to check the model. It doesn't report any errors and, surprisingly, the application works fine, the persistent index invalidation after removal works correctly now.

    I also compiled the application in release mode (which links with the release rather than the debug versions of Qt). Again, the problem dissapears.

    To me this looks like a bug in the debug libraries. BTW - we use MinGW and gcc 4.6.1.

    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 Extensions
    • Unsolved