diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp index a81b092a1db265155cc9b5147bd084ac6767b1cf..04f2ac0eb626cbc93ab8648a8c1240ce1c2f6a3b 100644 --- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp @@ -105,6 +105,7 @@ void QmlProfilerClientManager::setTcpConnection(QString host, quint64 port) { d->tcpHost = host; d->tcpPort = port; + disconnectClient(); } void QmlProfilerClientManager::clearBufferedData() @@ -135,6 +136,8 @@ void QmlProfilerClientManager::connectClient(quint16 port) connect(d->connection, SIGNAL(errorMessage(QString)), this, SLOT(logState(QString))); connect(d->connection, SIGNAL(opened()), this, SLOT(qmlDebugConnectionOpened())); connect(d->connection, SIGNAL(closed()), this, SLOT(qmlDebugConnectionClosed())); + connect(d->connection, &QmlDebugConnection::error, + this, &QmlProfilerClientManager::qmlDebugConnectionError); d->connectionTimer.start(); d->tcpPort = port; } @@ -276,6 +279,17 @@ void QmlProfilerClientManager::qmlDebugConnectionClosed() emit connectionClosed(); } +void QmlProfilerClientManager::qmlDebugConnectionError(QDebugSupport::Error error) +{ + logState(tr("Debug connection error %1").arg(error)); + if (d->connection->isOpen()) { + disconnectClient(); + emit connectionClosed(); + } else { + disconnectClient(); + } +} + void QmlProfilerClientManager::logState(const QString &msg) { QString state = QLatin1String("QML Profiler: ") + msg; diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.h b/src/plugins/qmlprofiler/qmlprofilerclientmanager.h index 6014e4607b20687873d1420b9e305eb3ce532731..0cbf88dc565fbbc75c228ee1dd948855e9f7e19c 100644 --- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.h +++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.h @@ -33,6 +33,7 @@ #include "qmlprofilerstatemanager.h" #include <qmldebug/qmlprofilereventlocation.h> +#include <qmldebug/qmldebugclient.h> #include <QObject> #include <QStringList> @@ -71,6 +72,7 @@ private slots: void tryToConnect(); void qmlDebugConnectionOpened(); void qmlDebugConnectionClosed(); + void qmlDebugConnectionError(QDebugSupport::Error error); void logState(const QString &); void retryMessageBoxFinished(int result);