QmlProfiler: Guard against the temporary trace file going away

If we cannot open a temporary file to cache a trace or retrieve a
previously cached trace, the QML profiler won't work correctly. Show
an error in this case.

Change-Id: I468d74d9c33033b9ad19501bccbd69a9fe164fed
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Ulf Hermann
2017-02-20 19:19:50 +01:00
parent 1ee8d0fb64
commit bf69eb9467
5 changed files with 56 additions and 24 deletions

View File

@@ -120,13 +120,17 @@ void QmlProfilerStatisticsModel::restrictToFeatures(qint64 features)
return;
clear();
d->modelManager->qmlModel()->replayEvents(d->modelManager->traceTime()->startTime(),
d->modelManager->traceTime()->endTime(),
std::bind(&QmlProfilerStatisticsModel::loadEvent,
this, std::placeholders::_1,
std::placeholders::_2));
finalize();
notesChanged(-1); // Reload notes
if (!d->modelManager->qmlModel()->replayEvents(d->modelManager->traceTime()->startTime(),
d->modelManager->traceTime()->endTime(),
std::bind(&QmlProfilerStatisticsModel::loadEvent,
this, std::placeholders::_1,
std::placeholders::_2))) {
emit d->modelManager->error(tr("Could not re-read events from temporary trace file."));
clear();
} else {
finalize();
notesChanged(-1); // Reload notes
}
}
const QHash<int, QmlProfilerStatisticsModel::QmlEventStats> &QmlProfilerStatisticsModel::getData() const