forked from qt-creator/qt-creator
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:
@@ -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)
|
||||
|
@@ -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));
|
||||
|
Reference in New Issue
Block a user