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

QItemSelectionModel memory leak in QAbstractItemView when switching between models

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.3.2, 5.5.1
    • Widgets: Itemviews
    • None

    Description

      Repeatedly calling setModel() (with another Model than the current one) leaks memory, even if you delete the SelectionModel as described in http://doc.qt.io/qt-5/qabstractitemview.html#setModel !

      Reason:
      As described in https://bugreports.qt.io/browse/QTBUG-10806, the setModel() call creates a new SelectionModel on the header, which is then replaced with the new SelectionModel of the View.

      Attachments

        1. qtreeview_and_the_leaking_selection_models.cpp
          4 kB
        2. qtmemleak2.h
          0.4 kB
        3. qtmemleak2.cpp
          0.6 kB
        4. main.cpp
          0.2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            m.denk Michael Denk
            Votes:
            8 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes