diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-02-20 19:19:50 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2017-02-24 11:55:16 +0000 |
commit | bf69eb9467b273357b15b8527bb0189d9841792f (patch) | |
tree | f0c2cdc2596ae53c2251342173c62965a445c9d7 /src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp | |
parent | 1ee8d0fb64b4a7c59fa4601fc8cad41372a8dd19 (diff) |
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>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp index f59c1c9a75..887dfe5254 100644 --- a/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilermodelmanager.cpp @@ -176,6 +176,10 @@ QmlProfilerModelManager::QmlProfilerModelManager(QObject *parent) : d->textMarkModel = new QmlProfilerTextMarkModel(this); connect(d->model, &QmlProfilerDataModel::allTypesLoaded, this, &QmlProfilerModelManager::processingDone); + connect(d->model, &QmlProfilerDataModel::traceFileError, + this, [this]() { + emit error(tr("Could not open a temporary file for storing QML traces.")); + }); } QmlProfilerModelManager::~QmlProfilerModelManager() @@ -543,12 +547,17 @@ void QmlProfilerModelManager::restrictToRange(qint64 startTime, qint64 endTime) setVisibleFeatures(0); startAcquiring(); - d->model->replayEvents(startTime, endTime, - std::bind(&QmlProfilerModelManagerPrivate::dispatch, d, - std::placeholders::_1, std::placeholders::_2)); - d->notesModel->setNotes(notes); - d->traceTime->restrictToRange(startTime, endTime); - acquiringDone(); + if (!d->model->replayEvents(startTime, endTime, + std::bind(&QmlProfilerModelManagerPrivate::dispatch, d, + std::placeholders::_1, std::placeholders::_2))) { + emit error(tr("Could not re-read events from temporary trace file. " + "The trace data is lost.")); + clear(); + } else { + d->notesModel->setNotes(notes); + d->traceTime->restrictToRange(startTime, endTime); + acquiringDone(); + } } bool QmlProfilerModelManager::isRestrictedToRange() const |