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

Memory leak in QHeaderView attached to QTreeView with hidden sections

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.0 RC 1
    • 4.6.2, 4.7.3
    • Widgets: Itemviews
    • None
    • qtbase: bf909bd637e4910a75b60df3b3ca5f2dd79515e4

    Description

      The sequence

      • Create QTreeView
      • Create Model
      • Call setModel()
      • Put some rows in the Model
      • Call setColumnHidden
      • Trigger the model's about-to-change-layout signal and change-layout signal

      leaks memory in the QHeaderView by filling up a QList and never emptying it. QHeaderViewPrivate::persistentHiddenSections is appended to in QHeaderView::_q_layoutAboutToBeChanged(), and cleared in _q_layoutChanged(), but QTreeView::setModel() disconnects the layoutChanged() signal to its QHeaderView, and doesn't seem to pass it down via any other mechanism. As a result, the list grows by a few elements every time the model goes through layout-change processing.

      Calling QTreeView::setHeader() after setModel results in a QTreeView that does not have this problem - only setModel() disconnects the signal, not setHeader().

      I have verified the problem in Qt 4.6.2 and 4.7.3

      Attachments

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

        Activity

          People

            liaqi Liang Qi
            jamesmpicone James Picone
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes