qmlprofiler tool: In attach mode, finish when connection drops

We won't have a process that terminates in this case and we don't want
to wait forever.

Task-number: QTBUG-66159
Change-Id: I5d0bbe2f8bc9c7cbc8732272ccca779d5f9bcc7d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Ulf Hermann 2018-02-02 13:24:44 +01:00
parent 6958308c09
commit fb84bcb487
2 changed files with 19 additions and 0 deletions

View File

@ -91,6 +91,8 @@ QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) :
connect(&m_connection, &QQmlDebugConnection::connected,
this, &QmlProfilerApplication::connected);
connect(&m_connection, &QQmlDebugConnection::disconnected,
this, &QmlProfilerApplication::disconnected);
connect(&m_qmlProfilerClient, &QmlProfilerClient::enabledChanged,
this, &QmlProfilerApplication::traceClientEnabledChanged);
@ -512,6 +514,22 @@ void QmlProfilerApplication::connected()
.arg(endpoint).arg(m_recording ? tr("on") : tr("off")));
}
void QmlProfilerApplication::disconnected()
{
if (m_runMode == AttachMode) {
int exitCode = 0;
if (m_recording) {
logError("Connection dropped while recording, last trace is damaged!");
exitCode = 2;
}
if (!m_interactive )
exit(exitCode);
else
m_qmlProfilerClient.clearPendingData();
}
}
void QmlProfilerApplication::processHasOutput()
{
Q_ASSERT(m_process);

View File

@ -69,6 +69,7 @@ private:
void run();
void tryToConnect();
void connected();
void disconnected();
void processHasOutput();
void processFinished();