Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ulf Hermann committed Feb 2, 2018
1 parent 6958308 commit fb84bcb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tools/qmlprofiler/qmlprofilerapplication.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions tools/qmlprofiler/qmlprofilerapplication.h
Expand Up @@ -69,6 +69,7 @@ class QmlProfilerApplication : public QCoreApplication
void run();
void tryToConnect();
void connected();
void disconnected();
void processHasOutput();
void processFinished();

Expand Down

0 comments on commit fb84bcb

Please sign in to comment.