QSortFilterProxyModel crash in while Invalidating filter.
-
wrote on 6 Jul 2018, 13:51 last edited by
Hi,
I am using QT 5.6.0 version.
I am facing a crash while invalidating QSortFilerProxyModel which is used in QTreeView.stack Trace is as below
Qt5Core.dll!QModelIndex::parent() Line 411 C++
Qt5Core.dll!QSortFilterProxyModelPrivate::source_to_proxy(const QModelIndex & source_index) Line 396 C++
Qt5Core.dll!QSortFilterProxyModel::mapFromSource(const QModelIndex & sourceIndex) Line 2762 C++
Qt5Core.dll!QSortFilterProxyModel::parent(const QModelIndex & child) Line 1894 C++
Qt5Core.dll!QModelIndex::parent() Line 411 C++
Qt5Core.dll!QPersistentModelIndex::parent() Line 365 C++
Qt5Core.dll!QItemSelectionRange::isValid() Line 139 C++
Qt5Core.dll!indexesFromRange<QVector<QPersistentModelIndex> >(const QItemSelectionRange & range, QVector<QPersistentModelIndex> & result) Line 308 C++
Qt5Core.dll!qSelectionPersistentindexes(const QItemSelection & sel) Line 477 C++
Qt5Core.dll!QItemSelectionModelPrivate::_q_layoutAboutToBeChanged(const QList<QPersistentModelIndex> & __formal, QAbstractItemModel::LayoutChangeHint hint) Line 889 C++
Qt5Core.dll!QItemSelectionModel::qt_static_metacall(QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 422 C++
Qt5Core.dll!QMetaObject::activate(QObject * sender, int signalOffset, int local_signal_index, void * * argv) Line 3732 C++
Qt5Core.dll!QMetaObject::activate(QObject * sender, const QMetaObject * m, int local_signal_index, void * * argv) Line 3595 C++
Qt5Core.dll!QAbstractItemModel::layoutAboutToBeChanged(const QList<QPersistentModelIndex> & _t1, QAbstractItemModel::LayoutChangeHint _t2) Line 589 C++
Qt5Core.dll!QSortFilterProxyModel::clear() Line 2560 C++
Could you plesae help me to resolve this sisue ?Thanks in advance ,
Seetharam -
wrote on 6 Jul 2018, 14:26 last edited by
- What source model are you using?
- Are you using any form of automatic sorting when data changes?
-
wrote on 6 Jul 2018, 14:56 last edited by
Hi,
Thanks for the reply.
I am using Source Model as QAbstractItemModel.I am not using any automatic sorting , but I am calling QSortFilterProxyModel->Invalidate() function to un- filter out data.
Regards,
Seetharam -
We need a proper testcase to say anything about this. Also there were some fixes after 5.6.0 in this area so I would fix test it with 5.11
-
Hi,
Thanks for the reply.
I am using Source Model as QAbstractItemModel.I am not using any automatic sorting , but I am calling QSortFilterProxyModel->Invalidate() function to un- filter out data.
Regards,
Seetharamwrote on 6 Jul 2018, 15:36 last edited by@seetharam said in QSortFilterProxyModel crash in while Invalidating filter.:
I am using Source Model as QAbstractItemModel.
That means custom model implementation.
can you show us yourparent()
implementation?If you are not using it already, the Qt Model Test is very useful in squashing common bugs in model implementations
-
wrote on 9 Jul 2018, 06:13 last edited by VRonin 7 Sept 2018, 07:33
template <class TreeItem> QModelIndex ModelImpl<TreeItem>::parent( const QModelIndex &curindex) const { QModelIndex res; if (curindex.isValid()) { TreeItem *childItem = GetItem(curindex); if ( childItem ) { TreeItem *parentItem = childItem->parent(); // here is the problem res = CreateIndexFromItem( parentItem ); } } return res; }
-
wrote on 9 Jul 2018, 07:34 last edited by
What's inside
TreeItem::parent()
? -
wrote on 10 Jul 2018, 15:03 last edited by
TreeItem::parent is default , there is no overriden function.
-
wrote on 10 Jul 2018, 16:13 last edited by
I have no idea what's the base class of
TreeItem
though... it's not a Qt class -
wrote on 11 Jul 2018, 09:53 last edited by
TreeItem is nothing but QTreeWidgetItem
-
wrote on 17 Jul 2018, 10:27 last edited by VRonin
Hi
Am getting crash in below place.xxxxx.dll!Vtree::ModelImpl<xxxxx::ItemBase>::rowCount(const QModelIndex & parent) Line 380 C++ Qt5Core.dll!QAbstractItemModel::hasIndex(int row, int column, const QModelIndex & parent) Line 1683 C++ xxxxx.dll!Vtree::ModelImpl<xxxxx::ItemBase>::index(int row, int column, const QModelIndex & parent) Line 296 C++ Qt5Core.dll!QSortFilterProxyModelPrivate::proxy_to_source(const QModelIndex & proxy_index) Line 383 C++ Qt5Core.dll!QSortFilterProxyModel::mapToSource(const QModelIndex & proxyIndex) Line 2750 C++ Qt5Core.dll!QSortFilterProxyModelPrivate::store_persistent_indexes() Line 1019 C++ Qt5Core.dll!QSortFilterProxyModelPrivate::_q_clearMapping() Line 310 C++ Qt5Core.dll!QSortFilterProxyModel::clear() Line 2562 C++
As per my analysis , I suspect that the proxy_index itself is getting currupted in below code.
QModelIndexPairList QSortFilterProxyModelPrivate::store_persistent_indexes() { Q_Q(QSortFilterProxyModel); QModelIndexPairList source_indexes; foreach (QPersistentModelIndexData *data, persistent.indexes) { QModelIndex proxy_index = data->index; QModelIndex source_index = q->mapToSource(proxy_index); source_indexes.append(qMakePair(proxy_index, QPersistentModelIndex(source_index))); } return source_indexes; }
Could you please Help me to solve this issue .
Could you please mention the fixed release of QT if this is known issue according to above stack trace.
Thanks and Regards,
Seetharam -
wrote on 17 Jul 2018, 10:46 last edited by
I'm quite confident the problem is inside
Vtree::ModelImpl<xxxxx::ItemBase>
and not insideQSortFilterProxyModel
. unfortunately if you can't share your model code ther's little we can do to help you
1/12