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

QTreeview::setModel calls functions from previous model leading to crash

    XMLWordPrintable

Details

    • c15a069830baf87f57c84e86326cf86ba9a39713 (qt/qtbase/5.14)

    Description

      QTreeview::setModel(nullptr) first calls QHeaderView::setModel and only after that QAbstractItemView::setModel.  QHeaderView::setModel emits sectionCountChanged signal leading to QTreeView::updateGeometries call. As QTreeView still thinks it has old model, it starts to ask data from the old model. But if that old model now is broken (e.g contains pointers to deleted objects), it will crash.

      Attached example will crash after one second of work inside setModel function.

      Attachments

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

        Activity

          People

            chehrlic Christian Ehrlicher
            alexey.telishev Alexey Telishev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes