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

QSortFilterProxyModelPrivate::source_items_removed() does not shrink the proxy-to-source mapping to reflect the new item count

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 4.6.1
    • Widgets: Itemviews
    • None
    • Linux

    Description

      In one instance source_items_removed() is given start=219, end=219, and the proxy_to_source mapping contains the following:

      {218,219,220,234}

      .

      source_items_removed() will not remove 219, leaving proxy_to_source.size() = 4.

      source_items_removed() will iterate over proxy_to_source and update its values to:

      {218,218,219,233}

      . this introduces duplicates in the proxy_to_source mapping that are not fixed during the course of source_items_removed().

      note that source_items_removed() does shrink the source_to_proxy mapping to reflect the new item count (but not the proxy_to_source mapping).

      after adding the following code, a mysterious crash in index_to_iterator() is no longer observed (starting at line 823 of qsortfilterproxymodel.cpp):

      // shrink the proxy-to-source mapping to reflect the new item count
      for (QVector<int>::iterator it2 = proxy_to_source.begin();
      it2 != proxy_to_source.end() {
      int idx = *it2;
      if (idx >= start && idx <= end)

      { it2 = proxy_to_source.erase(it2); }

      else

      { ++it2; }

      }

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              vfm Thierry Bastian (closed Nokia identity) (Inactive)
              mike.otj Mike
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes