Details
-
Suggestion
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
4.5.3
-
None
Description
Can you, please, add d->model->rowCount() == 0 || checking to these asserts?
When model is empty, these asserts check nothing, but call model::index() with "invalid" args.
It's legal but always suspicious, and should be avoided, I think.
// These asserts do basic sanity checking of the model
Q_ASSERT_X(d->model->rowCount() == 0 || d->model->index(0,0) == d->model->index(0,0),
"QAbstractItemView::setModel",
"A model should return the exact same index "
"(including its internal id/pointer) when asked for it twice in a row.");
Q_ASSERT_X(d->model->rowCount() == 0 || d->model->index(0,0).parent() == QModelIndex(),
"QAbstractItemView::setModel",
"The parent of a top level index should be invalid");
Attachments
Issue Links
- relates to
-
QTBUG-40624 Crash in QAbstractItemView::setModel()
-
- Reported
-