AutoTest: Avoid potential crash

Invalidating the filter model may crash while updating
the source model as it emits a layoutChanged().
Just invalidating the filter works as the sorting of items
is not touched.
Workaround this by explicitly using invalidateFilter()
instead of invalidate().

Task-number: QTBUG-103952
Change-Id: I52abda3936e870bb448c420e98a122edecffda7e
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2023-02-02 15:19:34 +01:00
parent d7308cc7a6
commit f48b8b7bcb
2 changed files with 4 additions and 1 deletions

View File

@@ -426,6 +426,10 @@ TestResultFilterModel::TestResultFilterModel(TestResultModel *sourceModel, QObje
{
setSourceModel(sourceModel);
enableAllResultTypes(true);
// instead of using invalidate() from results pane when adding a new result ( QTBUG-103952 )
connect(sourceModel, &QAbstractItemModel::rowsInserted,
this, &TestResultFilterModel::invalidateFilter);
}
void TestResultFilterModel::enableAllResultTypes(bool enabled)

View File

@@ -228,7 +228,6 @@ void TestResultsPane::addTestResult(const TestResult &result)
m_atEnd = scrollBar ? scrollBar->value() == scrollBar->maximum() : true;
m_model->addTestResult(result, m_expandCollapse->isChecked());
m_filterModel->invalidate();
setIconBadgeNumber(m_model->resultTypeCount(ResultType::Fail)
+ m_model->resultTypeCount(ResultType::MessageFatal)
+ m_model->resultTypeCount(ResultType::UnexpectedPass));