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

crash in model/view framework

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • 4.8.4
    • 4.8.3, 4.8.4
    • Widgets: Itemviews
    • None
    • 989e6c5ee6f3e38b24632ec5caf49c5b03d17aed

    Description

      Sequence of steps to reproduce crash:

      1)Create tree similar to

       
      root
       |-- ch1
       |    |-- n1
       |
       |-- ch2
            |- n2
      

      2)Filter out ch1 and ch2 with QSortFilterProxyModel::filterAcceptsRow

      3) Try to remove 1st and 2nd rows (ch1 and ch2)

      4) CRASH!

      My initial investigation and gdb say that in function

      void QSortFilterProxyModelPrivate::updateChildrenMapping(const QModelIndex &source_parent, Mapping *parent_mapping,
                                                               Qt::Orientation orient, int start, int end, int delta_item_count, bool remove)
      

      at line

                  Mapping *cm = source_index_mapping.take(source_child_index);
      

      you get null cm, because hash source_index_mapping does not contain such source_child_index index and then you are trying to use it.

      In attachment is minimal example to reproduce the bug.

      P.S. Yes, I know that I can say to function removeRows to remove two rows at once, but this example was taken from real big programme, and in this real programme it is difficult and not efficiently to combine separate rows in one bundle.

      Attachments

        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)
            dimanne DimanNe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes