Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.2, 4.7.3
-
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