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

QAccessibleTableCell stores QModelIndex

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Duplicate
    • Affects Version/s: 5.6.1
    • Fix Version/s: 5.8.0
    • Component/s: Widgets: Itemviews
    • Labels:
      None
    • Environment:
      MS Windows 7 x64. Visual Studio 2013. MTM (Microsoft Test Manager)
    • Commits:
      bd591064be388216f91d48522b3bdbc1be93bb92

      Description

      QAccessibleTableCell uses QModelIndex to store it internally. It causes seldom crashes when such indexes becomes invalid (due to batch delete from model).
      In our case app crashes under Microsoft Test Manager after deleting couple of rows from QTreeView with custom data model:

       	Mdk.dll!mdk::SiteTreeModel::parent(const QModelIndex & i_index={...}) Line 175
       	Qt5Corematd.dll!QModelIndex::parent() Line 411
       	Qt5Widgetsmatd.dll!QTreeView::isIndexHidden(const QModelIndex & index={...}) Line 3044
       	Qt5Widgetsmatd.dll!QTreeView::visualRect(const QModelIndex & index={...}) Line 1106
       	Qt5Widgetsmatd.dll!QAccessibleTableCell::rect() Line 1057
       	Qt5Widgetsmatd.dll!QAccessibleTableCell::state() Line 1024
      	qwindowsd.dll!QWindowsMsaaAccessible::get_accState(tagVARIANT varID, tagVARIANT * pvarState=0x000000000029ba30) Line 958
      

      isIndexHidden called with index stored in QAccessibleTableCell and there is no object in model for QModelIndex::internalPointer.

      As said in QModelIndex doc:

      Note: Model indexes should be used immediately and then discarded. You should not rely on indexes to remain valid after calling model functions that change the structure of the model or delete items. If you need to keep a model index over time use a QPersistentModelIndex.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              mmutz Marc Mutz
              Reporter:
              uaf Igor Yampolskiy
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes