Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
Qt Creator 6.0.0-beta1
-
None
-
-
71cfd0d2d0e21ed35ca11ebb33a0c4bc9ce2e4bc (qt-creator/tqtc-qt-creator/master)
Description
To reproduce:
1. Open help mode and activate "Index" from combobox.
2. Start typing inside "Look for:" field. Type: "file" - should be OK, since the filter model isn't empty.
3. Type now "g" - filter model becames empty. Crash.
Most probably the reason is inside indexwindow.cpp : 118. I've added debug printout like this:
void IndexWindow::filterIndices(const QString &filter) { QModelIndex bestMatch; if (filter.contains(QLatin1Char('*'))) bestMatch = m_filteredIndexModel->filter(filter, filter); else bestMatch = m_filteredIndexModel->filter(filter, QString()); if (bestMatch.isValid()) { qDebug() << "filter:" << filter << "row:" << bestMatch.row() << "col:" << bestMatch.column() << "model row count:" << m_filteredIndexModel->rowCount(); m_indexWidget->setCurrentIndex(bestMatch); m_indexWidget->scrollTo(bestMatch); } }
So it looks like we are trying to call setCurrentIndex with valid index (0, 0) to the model that has 0 row count. It looks like Qt 5.15 accepted it, and Qt 6.2 doesn't like it.
Other threads look OK.
This crash has been seen after applying https://codereview.qt-project.org/c/qt/qtbase/+/372436 to Qt 6.2.
The message from output:
qt.core.qabstractitemmodel.checkindex: Index QModelIndex(0,0,0x0,Help::Internal::IndexFilterModel(0x2944400)) has out of range row 0 rowCount() is 0
ASSERT: "checkIndex(index, CheckIndexOption::IndexIsValid)" in file /home/jarek/dev/qt-62/qtbase/src/corelib/itemmodels/qabstractitemmodel.cpp, line 3701
Call stack:
Thread 1 (Thread 0x7fa332aa8940 (LWP 795345)): #0 0x00007fa3367d12a2 in raise () from /lib64/libc.so.6 #1 0x00007fa3367ba8a4 in abort () from /lib64/libc.so.6 #2 0x00007fa336dcc423 in qt_message_fatal (context=..., message=...) at /home/jarek/dev/qt-62/qtbase/src/corelib/global/qlogging.cpp:1898 #3 0x00007fa336dc8598 in QMessageLogger::fatal (this=0x7ffc0c555380, msg=0x7fa33724db28 "ASSERT: \"%s\" in file %s, line %d") at /home/jarek/dev/qt-62/qtbase/src/corelib/global/qlogging.cpp:890 #4 0x00007fa336dbd5f0 in qt_assert (assertion=0x7fa33725f960 "checkIndex(index, CheckIndexOption::IndexIsValid)", file=0x7fa33725f240 "/home/jarek/dev/qt-62/qtbase/src/corelib/itemmodels/qabstractitemmodel.cpp", line=3701) at /home/jarek/dev/qt-62/qtbase/src/corelib/global/qglobal.cpp:3281 #5 0x00007fa336e586ea in QAbstractItemModel::multiData (this=0x2944400, index=..., roleDataSpan=...) at /home/jarek/dev/qt-62/qtbase/src/corelib/itemmodels/qabstractitemmodel.cpp:3701 #6 0x00007fa338a1d24e in QModelIndex::multiData (this=0x7ffc0c5557b0, roleDataSpan=...) at qtbase/include/QtCore/../../../../qt-62/qtbase/src/corelib/itemmodels/qabstractitemmodel.h:532 #7 0x00007fa338a1b953 in QStyledItemDelegate::initStyleOption (this=0x2942390, option=0x7ffc0c555650, index=...) at /home/jarek/dev/qt-62/qtbase/src/widgets/itemviews/qstyleditemdelegate.cpp:294 #8 0x00007fa338a1c3c4 in QStyledItemDelegate::sizeHint (this=0x2942390, option=..., index=...) at /home/jarek/dev/qt-62/qtbase/src/widgets/itemviews/qstyleditemdelegate.cpp:426 #9 0x00007fa338a9146a in QTreeView::indexRowSizeHint (this=0x2949110, index=...) at /home/jarek/dev/qt-62/qtbase/src/widgets/itemviews/qtreeview.cpp:3029 #10 0x00007fa338a92ea7 in QTreeViewPrivate::layout (this=0x29437a0, i=-1, recursiveExpanding=false, afterIsUninitialized=false) at /home/jarek/dev/qt-62/qtbase/src/widgets/itemviews/qtreeview.cpp:3376 #11 0x00007fa338a8d686 in QTreeView::doItemsLayout (this=0x2949110) at /home/jarek/dev/qt-62/qtbase/src/widgets/itemviews/qtreeview.cpp:2139 #12 0x00007fa3389df0e4 in QAbstractItemViewPrivate::executePostedLayout (this=0x29437a0) at qtbase/include/QtWidgets/6.2.0/QtWidgets/private/../../../../../../../qt-62/qtbase/src/widgets/itemviews/qabstractitemview_p.h:231 #13 0x00007fa338a8874d in QTreeView::visualRect (this=0x2949110, index=...) at /home/jarek/dev/qt-62/qtbase/src/widgets/itemviews/qtreeview.cpp:1111 #14 0x00007fa338a8eb26 in QTreeView::visualRegionForSelection (this=0x2949110, selection=...) at /home/jarek/dev/qt-62/qtbase/src/widgets/itemviews/qtreeview.cpp:2395 #15 0x00007fa3389d8279 in QAbstractItemView::selectionChanged (this=0x2949110, selected=..., deselected=...) at /home/jarek/dev/qt-62/qtbase/src/widgets/itemviews/qabstractitemview.cpp:3651 #16 0x00007fa338a95fc8 in QTreeView::selectionChanged (this=0x2949110, selected=..., deselected=...) at /home/jarek/dev/qt-62/qtbase/src/widgets/itemviews/qtreeview.cpp:4048 #17 0x00007fa3389dc4cc in QAbstractItemView::qt_static_metacall (_o=0x2949110, _c=QMetaObject::InvokeMetaMethod, _id=21, _a=0x7ffc0c5561c0) at qtbase/src/widgets/Widgets_autogen/include/moc_qabstractitemview.cpp:397 #18 0x00007fa336f264dc in doActivate<false> (sender=0x294d010, signal_index=3, argv=0x7ffc0c5561c0) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qobject.cpp:3916 #19 0x00007fa336f1eda9 in QMetaObject::activate (sender=0x294d010, m=0x7fa337540d40 <QItemSelectionModel::staticMetaObject>, local_signal_index=0, argv=0x7ffc0c5561c0) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qobject.cpp:3964 #20 0x00007fa336e89aa7 in QItemSelectionModel::selectionChanged (this=0x294d010, _t1=..., _t2=...) at qtbase/src/corelib/Core_autogen/include/moc_qitemselectionmodel.cpp:478 #21 0x00007fa336e87ff4 in QItemSelectionModel::emitSelectionChanged (this=0x294d010, newSelection=..., oldSelection=...) at /home/jarek/dev/qt-62/qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp:1941 #22 0x00007fa336e85988 in QItemSelectionModel::select (this=0x294d010, selection=..., command=...) at /home/jarek/dev/qt-62/qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp:1361 #23 0x00007fa336e8560f in QItemSelectionModel::select (this=0x294d010, index=..., command=...) at /home/jarek/dev/qt-62/qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp:1208 #24 0x00007fa336e85e5a in QItemSelectionModel::setCurrentIndex (this=0x294d010, index=..., command=...) at /home/jarek/dev/qt-62/qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp:1436 #25 0x00007fa3389ce5b8 in QAbstractItemView::setCurrentIndex (this=0x2949110, index=...) at /home/jarek/dev/qt-62/qtbase/src/widgets/itemviews/qabstractitemview.cpp:1099 #26 0x00007fa2f1a496ee in Help::Internal::IndexWindow::filterIndices (this=0x2943660, filter=...) at /home/jarek/dev/creator-master/src/shared/help/indexwindow.cpp:127 #27 0x00007fa2f1a4d2bd in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<QString const&>, void, void (Help::Internal::IndexWindow::*)(QString const&)>::call (f=(void (Help::Internal::IndexWindow::*)(Help::Internal::IndexWindow * const, const QString &)) 0x7fa2f1a495d2 <Help::Internal::IndexWindow::filterIndices(QString const&)>, o=0x2943660, arg=0x7ffc0c556970) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qobjectdefs_impl.h:152 #28 0x00007fa2f1a4ce2e in QtPrivate::FunctionPointer<void (Help::Internal::IndexWindow::*)(QString const&)>::call<QtPrivate::List<QString const&>, void> (f=(void (Help::Internal::IndexWindow::*)(Help::Internal::IndexWindow * const, const QString &)) 0x7fa2f1a495d2 <Help::Internal::IndexWindow::filterIndices(QString const&)>, o=0x2943660, arg=0x7ffc0c556970) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qobjectdefs_impl.h:185 #29 0x00007fa2f1a4c80f in QtPrivate::QSlotObject<void (Help::Internal::IndexWindow::*)(QString const&), QtPrivate::List<QString const&>, void>::impl (which=1, this_=0x2944130, r=0x2943660, a=0x7ffc0c556970, ret=0x0) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qobjectdefs_impl.h:395 #30 0x00007fa336ec0c91 in QtPrivate::QSlotObjectBase::call (this=0x2944130, r=0x2943660, a=0x7ffc0c556970) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qobjectdefs_impl.h:375 #31 0x00007fa336f26443 in doActivate<false> (sender=0x29496f0, signal_index=7, argv=0x7ffc0c556970) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qobject.cpp:3904 #32 0x00007fa336f1eda9 in QMetaObject::activate (sender=0x29496f0, m=0x7fa338ed7100 <QLineEdit::staticMetaObject>, local_signal_index=0, argv=0x7ffc0c556970) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qobject.cpp:3964 #33 0x00007fa33882232f in QLineEdit::textChanged (this=0x29496f0, _t1=...) at qtbase/src/widgets/Widgets_autogen/include/moc_qlineedit.cpp:429 #34 0x00007fa338821603 in QLineEdit::qt_static_metacall (_o=0x29496f0, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7ffc0c556cc0) at qtbase/src/widgets/Widgets_autogen/include/moc_qlineedit.cpp:236 #35 0x00007fa336f264dc in doActivate<false> (sender=0x291bd50, signal_index=6, argv=0x7ffc0c556cc0) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qobject.cpp:3916 #36 0x00007fa336f1eda9 in QMetaObject::activate (sender=0x291bd50, m=0x7fa338ed7680 <QWidgetLineControl::staticMetaObject>, local_signal_index=3, argv=0x7ffc0c556cc0) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qobject.cpp:3964 #37 0x00007fa338832791 in QWidgetLineControl::textChanged (this=0x291bd50, _t1=...) at qtbase/src/widgets/Widgets_autogen/include/moc_qwidgetlinecontrol_p.cpp:277 #38 0x00007fa33882c23e in QWidgetLineControl::finishChange (this=0x291bd50, validateFromState=5, update=false, edited=true) at /home/jarek/dev/qt-62/qtbase/src/widgets/widgets/qwidgetlinecontrol.cpp:750 #39 0x00007fa33882a7cd in QWidgetLineControl::insert (this=0x291bd50, newText=...) at /home/jarek/dev/qt-62/qtbase/src/widgets/widgets/qwidgetlinecontrol.cpp:269 #40 0x00007fa338831d5a in QWidgetLineControl::processKeyEvent (this=0x291bd50, event=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/widgets/widgets/qwidgetlinecontrol.cpp:1954 #41 0x00007fa33881dd00 in QLineEdit::keyPressEvent (this=0x29496f0, event=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/widgets/widgets/qlineedit.cpp:1776 #42 0x00007fa339213463 in Utils::FancyLineEdit::keyPressEvent (this=0x29496f0, event=0x7ffc0c558270) at /home/jarek/dev/creator-master/src/libs/utils/fancylineedit.cpp:385 #43 0x00007fa338651aa8 in QWidget::event (this=0x29496f0, event=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/widgets/kernel/qwidget.cpp:8726 #44 0x00007fa33881d104 in QLineEdit::event (this=0x29496f0, e=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/widgets/widgets/qlineedit.cpp:1510 #45 0x00007fa3391bd844 in Utils::CompletingLineEdit::event (this=0x29496f0, e=0x7ffc0c558270) at /home/jarek/dev/creator-master/src/libs/utils/completinglineedit.cpp:54 #46 0x00007fa3385d2388 in QApplicationPrivate::notify_helper (this=0x1893070, receiver=0x29496f0, e=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/widgets/kernel/qapplication.cpp:3401 #47 0x00007fa3385cfb52 in QApplication::notify (this=0x7ffc0c558ab0, receiver=0x29496f0, e=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/widgets/kernel/qapplication.cpp:2782 #48 0x00007fa336ea2c28 in QCoreApplication::notifyInternal2 (receiver=0x29496f0, event=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qcoreapplication.cpp:1063 #49 0x00007fa336ea2ca0 in QCoreApplication::forwardEvent (receiver=0x29496f0, event=0x7ffc0c558270, originatingEvent=0x0) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qcoreapplication.cpp:1078 #50 0x00007fa338684a73 in QWidgetWindow::handleKeyEvent (this=0x1b28a40, event=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/widgets/kernel/qwidgetwindow.cpp:718 #51 0x00007fa338682c71 in QWidgetWindow::event (this=0x1b28a40, event=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/widgets/kernel/qwidgetwindow.cpp:288 #52 0x00007fa3385d2388 in QApplicationPrivate::notify_helper (this=0x1893070, receiver=0x1b28a40, e=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/widgets/kernel/qapplication.cpp:3401 #53 0x00007fa3385cf935 in QApplication::notify (this=0x7ffc0c558ab0, receiver=0x1b28a40, e=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/widgets/kernel/qapplication.cpp:2760 #54 0x00007fa336ea2c28 in QCoreApplication::notifyInternal2 (receiver=0x1b28a40, event=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qcoreapplication.cpp:1063 #55 0x00007fa336ea3634 in QCoreApplication::sendSpontaneousEvent (receiver=0x1b28a40, event=0x7ffc0c558270) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qcoreapplication.cpp:1483 #56 0x00007fa337abf721 in QGuiApplicationPrivate::processKeyEvent (e=0x7fa320013260) at /home/jarek/dev/qt-62/qtbase/src/gui/kernel/qguiapplication.cpp:2369 #57 0x00007fa337abe2ef in QGuiApplicationPrivate::processWindowSystemEvent (e=0x7fa320013260) at /home/jarek/dev/qt-62/qtbase/src/gui/kernel/qguiapplication.cpp:2003 #58 0x00007fa337b348c7 in QWindowSystemInterface::sendWindowSystemEvents (flags=...) at /home/jarek/dev/qt-62/qtbase/src/gui/kernel/qwindowsysteminterface.cpp:1166 #59 0x00007fa338087211 in userEventSourceDispatch (source=0x18a6f50) at /home/jarek/dev/qt-62/qtbase/src/gui/platform/unix/qeventdispatcher_glib.cpp:74 #60 0x00007fa333b7e4cf in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #61 0x00007fa333bd24f8 in g_main_context_iterate.constprop () from /lib64/libglib-2.0.so.0 #62 0x00007fa333b7bc03 in g_main_context_iteration () from /lib64/libglib-2.0.so.0 #63 0x00007fa33720d44e in QEventDispatcherGlib::processEvents (this=0x189ec90, flags=...) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:429 #64 0x00007fa33808745e in QPAEventDispatcherGlib::processEvents (this=0x189ec90, flags=...) at /home/jarek/dev/qt-62/qtbase/src/gui/platform/unix/qeventdispatcher_glib.cpp:123 #65 0x00007fa336eb5313 in QEventLoop::processEvents (this=0x7ffc0c558690, flags=...) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qeventloop.cpp:139 #66 0x00007fa336eb5643 in QEventLoop::exec (this=0x7ffc0c558690, flags=...) at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qeventloop.cpp:232 #67 0x00007fa336ea343f in QCoreApplication::exec () at /home/jarek/dev/qt-62/qtbase/src/corelib/kernel/qcoreapplication.cpp:1378 #68 0x00007fa337abdbc6 in QGuiApplication::exec () at /home/jarek/dev/qt-62/qtbase/src/gui/kernel/qguiapplication.cpp:1860 #69 0x00007fa3385cf30f in QApplication::exec () at /home/jarek/dev/qt-62/qtbase/src/widgets/kernel/qapplication.cpp:2610 #70 0x000000000040f10a in main (argc=1, argv=0x7ffc0c559ce8) at /home/jarek/dev/creator-master/src/app/main.cpp:772