diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-02-08 16:51:48 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2016-02-09 09:53:45 +0000 |
commit | 21d1f6161ead9fc9968175a6cda0592962080d4a (patch) | |
tree | 13bb3f7389ce98f1156f3be53ac1bb3665a89e23 /src/plugins/qmlprofiler/qmlprofilertracefile.h | |
parent | 0dff03e6fe6c87917afa43a815a3205e7a5692de (diff) |
QmlProfiler: Avoid race conditions when loading or saving data
We cannot assume that the model manager is still available when the
operation finishes. Also, accessing the QML model or the trace time
from the thread is dangerous.
Change-Id: I673c57c09490a0e3e2647f3197929eff1ce4ceb3
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'src/plugins/qmlprofiler/qmlprofilertracefile.h')
-rw-r--r-- | src/plugins/qmlprofiler/qmlprofilertracefile.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/qmlprofiler/qmlprofilertracefile.h b/src/plugins/qmlprofiler/qmlprofilertracefile.h index 5a5080c1be..f29b04634d 100644 --- a/src/plugins/qmlprofiler/qmlprofilertracefile.h +++ b/src/plugins/qmlprofiler/qmlprofilertracefile.h @@ -50,14 +50,21 @@ class QmlProfilerFileReader : public QObject public: explicit QmlProfilerFileReader(QObject *parent = 0); - void setQmlDataModel(QmlProfilerDataModel *dataModel); void setFuture(QFutureInterface<void> *future); bool load(QIODevice *device); quint64 loadedFeatures() const; + qint64 traceStart() const { return m_traceStart; } + qint64 traceEnd() const { return m_traceEnd; } + + const QVector<QmlProfilerDataModel::QmlEventTypeData> &qmlEvents() const { return m_qmlEvents; } + const QVector<QmlProfilerDataModel::QmlEventData> &ranges() const { return m_ranges; } + const QVector<QmlProfilerDataModel::QmlEventNoteData> ¬es() const { return m_notes; } + signals: void error(const QString &error); + void success(); private: void loadEventData(QXmlStreamReader &reader); @@ -66,7 +73,7 @@ private: void progress(QIODevice *device); bool isCanceled() const; - QmlProfilerDataModel *m_qmlModel; + qint64 m_traceStart, m_traceEnd; QFutureInterface<void> *m_future; QVector<QmlProfilerDataModel::QmlEventTypeData> m_qmlEvents; QVector<QmlProfilerDataModel::QmlEventData> m_ranges; |