forked from qt-creator/qt-creator
QmlProfiler: Detect interrupted execution
Task-number: QTCREATORBUG-8022 The profiler would switch to state "AppKilled" if the connection was cut before all the profiling data could be read. With Qt4.8, however, the application dies before any data is sent at all, and such state would never be reached. This patch fixes the flow of states and properly detects when an application started profiling successfully but dies before delivering the data. If the application doesn't run at all (for example, launching a QtQuick1.1 app from Qt5), the profiler fails gracefully without showing the error dialog. Change-Id: I6fc53127b5dfe41de112e140b77895d430d3f79c Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
committed by
Kai Koehne
parent
6e72163b40
commit
342f684277
@@ -290,6 +290,11 @@ void QmlProfilerDataModel::clear()
|
||||
setState(Empty);
|
||||
}
|
||||
|
||||
void QmlProfilerDataModel::prepareForWriting()
|
||||
{
|
||||
setState(AcquiringData);
|
||||
}
|
||||
|
||||
void QmlProfilerDataModel::addRangedEvent(int type, int bindingType, qint64 startTime,
|
||||
qint64 length, const QStringList &data,
|
||||
const QmlDebug::QmlEventLocation &location)
|
||||
|
@@ -165,6 +165,7 @@ signals:
|
||||
public slots:
|
||||
void clear();
|
||||
|
||||
void prepareForWriting();
|
||||
void addRangedEvent(int type, int bindingType, qint64 startTime, qint64 length,
|
||||
const QStringList &data, const QmlDebug::QmlEventLocation &location);
|
||||
void addV8Event(int depth,const QString &function,const QString &filename, int lineNumber, double totalTime, double selfTime);
|
||||
|
@@ -692,6 +692,7 @@ void QmlProfilerTool::profilerStateChanged()
|
||||
}
|
||||
case QmlProfilerStateManager::AppKilled : {
|
||||
showNonmodalWarning(tr("Application finished before loading profiled data.\nPlease use the stop button instead."));
|
||||
d->m_profilerDataModel->clear();
|
||||
break;
|
||||
}
|
||||
case QmlProfilerStateManager::Idle :
|
||||
@@ -720,6 +721,7 @@ void QmlProfilerTool::serverRecordingChanged()
|
||||
// clear the old data each time we start a new profiling session
|
||||
if (d->m_profilerState->serverRecording()) {
|
||||
clearData();
|
||||
d->m_profilerDataModel->prepareForWriting();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user