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

Crash when resizing QListView

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P1: Critical
    • 4.8.0
    • 4.6.0, 4.7.3
    • Widgets: Itemviews
    • None
    • Ubuntu, GNOME (but reproducible on other platforms too)

    Description

      The following program can easily be made to crash by resizing the list view in a certain way:

      #include <QApplication>
      #include <QListView>
      #include <QStringListModel>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QStringListModel model;
          QStringList list;
          for (int i = 0; i < 7; ++i)
              list.append(QString::number(i).repeated(12));
          model.setStringList(list);
      
          QListView w;
          w.setModel(&model);
          w.show();
      
          return a.exec();
      }
      

      The "certain way" seems to be to resize the view in such a way that makes one of the scrollbars disappear while making the other scrollbar appear. It's easy to do when you resize it fast with the bottom-right corner moving close by the bottom-right of the last entry in the list.

      The crash happens due to infinite recursion in some layout code. A backtrace is attached.

      The above is a small example reproducing the issue, after encountering it in both Qt Creator (with the "Insert variable" window in the External Tools settings) and in my own tile map editor project (with a QUndoView in a QDockWidget).

      Note that resizing is not the only way to trigger the issue. In my tile map editor it most frequently happens when a new entry is added to the list (see http://sourceforge.net/apps/mantisbt/tiled/view.php?id=67 for an unfortunately incomplete backtrace, that was triggered by a new entry appearing in the QUndoView).

      Attachments

        1. backtrace.txt
          18 kB
          Thorbjørn Lindeijer (closed Nokia identity)

        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)
              lindeije Thorbjørn Lindeijer (closed Nokia identity) (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes