I have a TreeItemModel visualised by a View, which uses some custom SortFilterProxyModels (i.e. classes derived from QSortFilterProxyModel) chained together. Those classes are performing different types of filtering. As long as I am emitting only dataChanged() events from the ItemModel everything works fine.
However, as soon as I emit a modelReset() from the ItemModel, the application crashes with a backtrace I don't get any clues from. I've played around a little, and it seems that using more than one SortFilter model leads to a crash (i.e. chaining two SortFilter models in a row). If I restrict myself to one model, things seem to work out.
The backtraces of a crash vary depending on the conditions.
Here are two versions (all orginating in calling reset() from the ItemModel).
#0 0x00002b61a15c213f in QSortFilterProxyModel::index () from /usr/lib/libQtGui.so.4
#1 0x00002b61a15c23a7 in QSortFilterProxyModel::parent () from /usr/lib/libQtGui.so.4
#2 0x00002b61a15c2142 in QSortFilterProxyModel::index () from /usr/lib/libQtGui.so.4
#3 0x00002b61a15c23a7 in QSortFilterProxyModel::parent () from /usr/lib/libQtGui.so.4
#4 0x00002b61a19871cb in QPersistentModelIndex::parent () from /usr/lib/libQtCore.so.4
#5 0x00002b61a1594ee4 in QItemSelectionRange::indexes () from /usr/lib/libQtGui.so.4
#6 0x00002b61a1594ffe in QItemSelection::indexes () from /usr/lib/libQtGui.so.4
#7 0x00002b61a159510c in QItemSelection::indexes () from /usr/lib/libQtGui.so.4
#8 0x00002b61a1599e5f in QItemSelectionModel::qt_metacall () from /usr/lib/libQtGui.so.4
#9 0x00002b61a199f4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#10 0x00002b61a15c52d1 in QSortFilterProxyModel::~QSortFilterProxyModel () from /usr/lib/libQtGui.so.4
#11 0x00002b61a15c5634 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#12 0x00002b61a199f4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#13 0x00002b61a15c5590 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#14 0x00002b61a5bd78e3 in NTagModel::FilterSelectedProxyModel::qt_metacall (this=0xde18d8,
_c
=QMetaObject::InvokeMetaMethod, _id
=23, _a
=0x7fff0a86cc70
) at .moc/moc_filterselectedproxymodel.cpp:56
#15 0x00002b61a199f4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#16 0x00002b61a15c554b in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#17 0x00002b61a5bd78e3 in NTagModel::FilterSelectedProxyModel::qt_metacall (this=0xde18d8,
_c
=QMetaObject::InvokeMetaMethod, _id
=26, _a
=0x7fff0a86d1e0
) at .moc/moc_filterselectedproxymodel.cpp:56
#18 0x00002b61a199f4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#19 0x00002b61a5bc4ca6 in NTagModel::VocabularyModel::setData (this=0x6c7b30, index=@0x7fff0a86d2d0,
value=@0x7fff0a86d390, role=32) at vocabularymodel.cpp:238
#20 0x00002b61a15c0519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#21 0x00002b61a15c0519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#22 0x00002b61a5bd0f5a in NTagModel::UnselectedTagsView::onItemDoubleClicked (this=0xde18b0,
index=@0xe6e050) at unselectedtagsview.cpp:109
#23 0x00002b61a5bd7817 in NTagModel::UnselectedTagsView::qt_metacall (this=0xde18b0,
_c
=QMetaObject::InvokeMetaMethod, _id
=1, _a
=0x7fff0a86d8f0
) at .
moc/moc_unselectedtagsview.
cpp:67#24 0x00002b61a199f4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#25 0x00002b61a1557345 in QAbstractItemView::doubleClicked () from /usr/lib/libQtGui.so.4
#0 0x00002b61a15c213f in QSortFilterProxyModel::index () from /usr/lib/libQtGui.so.4
#1 0x00002b61a15c23a7 in QSortFilterProxyModel::parent () from /usr/lib/libQtGui.so.4
#2 0x00002b61a15c2142 in QSortFilterProxyModel::index () from /usr/lib/libQtGui.so.4
#3 0x00002b61a15c23a7 in QSortFilterProxyModel::parent () from /usr/lib/libQtGui.so.4
#4 0x00002b61a19871cb in QPersistentModelIndex::parent () from /usr/lib/libQtCore.so.4
#5 0x00002b61a1594ee4 in QItemSelectionRange::indexes () from /usr/lib/libQtGui.so.4
#6 0x00002b61a1594ffe in QItemSelection::indexes () from /usr/lib/libQtGui.so.4
#7 0x00002b61a159510c in QItemSelection::indexes () from /usr/lib/libQtGui.so.4
#8 0x00002b61a1599e5f in QItemSelectionModel::qt_metacall () from /usr/lib/libQtGui.so.4
#9 0x00002b61a199f4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#10 0x00002b61a15c52d1 in QSortFilterProxyModel::~QSortFilterProxyModel () from /usr/lib/libQtGui.so.4
#11 0x00002b61a15c5634 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#12 0x00002b61a199f4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#13 0x00002b61a15c5590 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#14 0x00002b61a5bd78e3 in NTagModel::FilterSelectedProxyModel::qt_metacall (this=0xde18d8,
_c=QMetaObject::InvokeMetaMethod, _id=23, _a=0x7fff0a86cc70)
at .moc/moc_filterselectedproxymodel.cpp:56
#15 0x00002b61a199f4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#16 0x00002b61a15c554b in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#17 0x00002b61a5bd78e3 in NTagModel::FilterSelectedProxyModel::qt_metacall (this=0xde18d8,
_c=QMetaObject::InvokeMetaMethod, _id=26, _a=0x7fff0a86d1e0)
at .moc/moc_filterselectedproxymodel.cpp:56
#18 0x00002b61a199f4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#19 0x00002b61a5bc4ca6 in NTagModel::VocabularyModel::setData (this=0x6c7b30, index=@0x7fff0a86d2d0,
value=@0x7fff0a86d390, role=32) at vocabularymodel.cpp:238
#20 0x00002b61a15c0519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#21 0x00002b61a15c0519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#22 0x00002b61a5bd0f5a in NTagModel::UnselectedTagsView::onItemDoubleClicked (this=0xde18b0,
index=@0xe6e050) at unselectedtagsview.cpp:109
#23 0x00002b61a5bd7817 in NTagModel::UnselectedTagsView::qt_metacall (this=0xde18b0,
_c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fff0a86d8f0) at .moc/moc_unselectedtagsview.cpp:67
#24 0x00002b61a199f4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#25 0x00002b61a1557345 in QAbstractItemView::doubleClicked () from /usr/lib/libQtGui.so.4
To copy to clipboard, switch view to plain text mode
#0 0x00002b414655c013 in QAbstractProxyModel::mapSelectionFromSource () from /usr/lib/libQtGui.so.4
#1 0x00002b414655df40 in QSortFilterProxyModel::rowCount () from /usr/lib/libQtGui.so.4
#2 0x00002b414655d740 in QSortFilterProxyModel::lessThan () from /usr/lib/libQtGui.so.4
#3 0x00002b414655e14d in QSortFilterProxyModel::index () from /usr/lib/libQtGui.so.4
#4 0x00002b414655e3a7 in QSortFilterProxyModel::parent () from /usr/lib/libQtGui.so.4
#5 0x00002b4146532a54 in QItemSelectionModel::isRowSelected () from /usr/lib/libQtGui.so.4
#6 0x00002b41465330c7 in QItemSelectionModel::isRowSelected () from /usr/lib/libQtGui.so.4
#7 0x00002b4146535e53 in QItemSelectionModel::qt_metacall () from /usr/lib/libQtGui.so.4
#8 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#9 0x00002b4146561366 in QSortFilterProxyModel::~QSortFilterProxyModel () from /usr/lib/libQtGui.so.4
#10 0x00002b4146561634 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#11 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#12 0x00002b4146561383 in QSortFilterProxyModel::~QSortFilterProxyModel () from /usr/lib/libQtGui.so.4
#13 0x00002b4146561634 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#14 0x00002b414ab73983 in NTagModel::FilterSelectedProxyModel::qt_metacall (this=0xddcb48,
_c
=QMetaObject::InvokeMetaMethod, _id
=28, _a
=0x7fff658d2100
) at .moc/moc_filterselectedproxymodel.cpp:56
#15 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#16 0x00002b4146561383 in QSortFilterProxyModel::~QSortFilterProxyModel () from /usr/lib/libQtGui.so.4
#17 0x00002b4146561634 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#18 0x00002b414ab7672f in NTagModel::EmptyTagFilter::qt_metacall (this=0xde1ab0,
_c
=QMetaObject::InvokeMetaMethod, _id
=28, _a
=0x7fff658d26c0
) at .
moc/moc_emptytagfilter.
cpp:56#19 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#20 0x00002b4146561590 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#21 0x00002b414ab73a5b in NTagModel::FilterHiddenProxyModel::qt_metacall (this=0xddcb60,
_c
=QMetaObject::InvokeMetaMethod, _id
=23, _a
=0x7fff658d2c30
) at .moc/moc_filterhiddenproxymodel.cpp:56
#22 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#23 0x00002b414656154b in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#24 0x00002b414ab73a5b in NTagModel::FilterHiddenProxyModel::qt_metacall (this=0xddcb60,
_c
=QMetaObject::InvokeMetaMethod, _id
=26, _a
=0x7fff658d31a0
) at .moc/moc_filterhiddenproxymodel.cpp:56
#25 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#26 0x00002b414ab60ca6 in NTagModel::VocabularyModel::setData (this=0x632270, index=@0x7fff658d3290,
value=@0x7fff658d33f0, role=32) at vocabularymodel.cpp:238
#27 0x00002b414655c519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#28 0x00002b414655c519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#29 0x00002b414655c519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#30 0x00002b414655c519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#31 0x00002b414ab6cf5a in NTagModel::UnselectedTagsView::onItemDoubleClicked (this=0xddcb20,
index=@0x137ce20) at unselectedtagsview.cpp:109
#0 0x00002b414655c013 in QAbstractProxyModel::mapSelectionFromSource () from /usr/lib/libQtGui.so.4
#1 0x00002b414655df40 in QSortFilterProxyModel::rowCount () from /usr/lib/libQtGui.so.4
#2 0x00002b414655d740 in QSortFilterProxyModel::lessThan () from /usr/lib/libQtGui.so.4
#3 0x00002b414655e14d in QSortFilterProxyModel::index () from /usr/lib/libQtGui.so.4
#4 0x00002b414655e3a7 in QSortFilterProxyModel::parent () from /usr/lib/libQtGui.so.4
#5 0x00002b4146532a54 in QItemSelectionModel::isRowSelected () from /usr/lib/libQtGui.so.4
#6 0x00002b41465330c7 in QItemSelectionModel::isRowSelected () from /usr/lib/libQtGui.so.4
#7 0x00002b4146535e53 in QItemSelectionModel::qt_metacall () from /usr/lib/libQtGui.so.4
#8 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#9 0x00002b4146561366 in QSortFilterProxyModel::~QSortFilterProxyModel () from /usr/lib/libQtGui.so.4
#10 0x00002b4146561634 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#11 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#12 0x00002b4146561383 in QSortFilterProxyModel::~QSortFilterProxyModel () from /usr/lib/libQtGui.so.4
#13 0x00002b4146561634 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#14 0x00002b414ab73983 in NTagModel::FilterSelectedProxyModel::qt_metacall (this=0xddcb48,
_c=QMetaObject::InvokeMetaMethod, _id=28, _a=0x7fff658d2100)
at .moc/moc_filterselectedproxymodel.cpp:56
#15 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#16 0x00002b4146561383 in QSortFilterProxyModel::~QSortFilterProxyModel () from /usr/lib/libQtGui.so.4
#17 0x00002b4146561634 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#18 0x00002b414ab7672f in NTagModel::EmptyTagFilter::qt_metacall (this=0xde1ab0,
_c=QMetaObject::InvokeMetaMethod, _id=28, _a=0x7fff658d26c0) at .moc/moc_emptytagfilter.cpp:56
#19 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#20 0x00002b4146561590 in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#21 0x00002b414ab73a5b in NTagModel::FilterHiddenProxyModel::qt_metacall (this=0xddcb60,
_c=QMetaObject::InvokeMetaMethod, _id=23, _a=0x7fff658d2c30)
at .moc/moc_filterhiddenproxymodel.cpp:56
#22 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#23 0x00002b414656154b in QSortFilterProxyModel::qt_metacall () from /usr/lib/libQtGui.so.4
#24 0x00002b414ab73a5b in NTagModel::FilterHiddenProxyModel::qt_metacall (this=0xddcb60,
_c=QMetaObject::InvokeMetaMethod, _id=26, _a=0x7fff658d31a0)
at .moc/moc_filterhiddenproxymodel.cpp:56
#25 0x00002b414693b4cb in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#26 0x00002b414ab60ca6 in NTagModel::VocabularyModel::setData (this=0x632270, index=@0x7fff658d3290,
value=@0x7fff658d33f0, role=32) at vocabularymodel.cpp:238
#27 0x00002b414655c519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#28 0x00002b414655c519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#29 0x00002b414655c519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#30 0x00002b414655c519 in QSortFilterProxyModel::setData () from /usr/lib/libQtGui.so.4
#31 0x00002b414ab6cf5a in NTagModel::UnselectedTagsView::onItemDoubleClicked (this=0xddcb20,
index=@0x137ce20) at unselectedtagsview.cpp:109
To copy to clipboard, switch view to plain text mode
I have no small test application, but if you use Debian you can get the source from
svn co https://packagesearch.svn.sourceforge.net/svnroot/packagesearch/branches/2.2-removeQT3 packagesearch
and download the build-depends using "apt-get build-dep packagesearch".
The relevant code is located in src/plugins/debtagsplugin/unselectedtagsview.cpp
The crashes happen if you double click on some items of the top right list.
There the lines
_filterChain.push_back(&_hiddenFilterProxyModel);
_filterChain.push_back(_pTagFilter);
_filterChain.push_back(&_filterSelectedProxyModel);
_filterChain.push_back(_pTextFilter);
_filterChain.push_back(&_hiddenFilterProxyModel);
_filterChain.push_back(_pTagFilter);
_filterChain.push_back(&_filterSelectedProxyModel);
_filterChain.push_back(_pTextFilter);
To copy to clipboard, switch view to plain text mode
control which filters shall be switched on. If you are willing to investigate and need more information please ask.
I am totally out of ideas, so any help would be appreciated.
Regards Ben
Bookmarks