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

QAbstractItemView::sizeHintForColumn() crashes if no delegate for an index

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.6.0 Beta
    • 5.5.0
    • Widgets: Itemviews
    • None
    • At least Visual Studio 2013, 32 bit
    •  2042a091a3e88a77d52b6cdb62f3fc9153d7f5d7 (qtbase/5.6, 19.10.2015, 5.6b)

    Description

      Program crashes if you call QAbstractItemView::sizeHintForColumn() and there's no delegate for an index.

      Problem is on row 3056 of file qabstractitemview.cpp:

      int hint = d->delegateForIndex(index)->sizeHint(option, index).width();

      It is legitimate for delegateForIndex() to return nullptr.
      Suggest to write it similar to:

      QAbstractItemDelegate *id = d->delegateForIndex(index);
      int hint = id ? id->sizeHint(option, index).width() : 0;

      Attachments

        1. qtbug48543_stack.txt
          8 kB
          Friedemann Kleint
        2. qtbug48543.zip
          0.9 kB
          Marco Lazzarotto
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            marcolazzarotto Marco Lazzarotto
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes