Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-18539

QStandardItemModel::setItem() causes crash in QTreeView

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 4.6.2, 4.7.3, 4.7.4
    • Widgets: Itemviews
    • None
    • Windows 7, Windows XP

    Description

      Creating a QTreeView with QStandardItemModel backing it, and then calling QStandardItemModel::setItem() triggers a crash in QTreeView. QTreeView keeps a list of the visible QModelIndexes in the QStandardItemModel, but QStandardItemModel::setItem() invalidates that cache (by deleting previously extant QStandardItems). setItem() doesn't cause QTreeView to reevaluate those indices, however, so QTreeView can crash when it starts trying to get parents from those indices.

      To get the included demonstration to crash, expand the node with the text "Test" in it.

      Attachments

        1. main.cpp
          1 kB
        2. qtbug_18539.tgz
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            stephen.kelly Stephen Kelly (Unused account) (Inactive)
            jamesmpicone James Picone
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes