diff --git a/src/libs/qmldebug/qmldebugconnectionmanager.cpp b/src/libs/qmldebug/qmldebugconnectionmanager.cpp index a13cb0f3ccc..2901e21d9d0 100644 --- a/src/libs/qmldebug/qmldebugconnectionmanager.cpp +++ b/src/libs/qmldebug/qmldebugconnectionmanager.cpp @@ -71,6 +71,11 @@ void QmlDebugConnectionManager::disconnectFromServer() stopConnectionTimer(); } +bool QmlDebugConnectionManager::isConnecting() const +{ + return m_connectionTimer.isActive(); +} + static quint16 port16(const QUrl &url) { const int port32 = url.port(); diff --git a/src/libs/qmldebug/qmldebugconnectionmanager.h b/src/libs/qmldebug/qmldebugconnectionmanager.h index b1b731c4bc6..2bab6b082c0 100644 --- a/src/libs/qmldebug/qmldebugconnectionmanager.h +++ b/src/libs/qmldebug/qmldebugconnectionmanager.h @@ -44,6 +44,7 @@ public: void connectToServer(const QUrl &server); void disconnectFromServer(); + bool isConnecting() const; bool isConnected() const; void setRetryParams(int interval, int maxAttempts); diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp index 5b44948d32e..dd8605a2d2c 100644 --- a/src/plugins/qmlprofiler/qmlprofilertool.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp @@ -316,6 +316,13 @@ void QmlProfilerTool::finalizeRunControl(QmlProfilerRunner *runWorker) d->m_toolBusy = false; updateRunActions(); disconnect(d->m_stopAction, &QAction::triggered, runControl, &RunControl::initiateStop); + + // If we're still trying to connect, stop now. + if (d->m_profilerConnections->isConnecting()) { + showNonmodalWarning(tr("The application finished before a connection could be " + "established. No data was loaded.")); + d->m_profilerConnections->disconnectFromServer(); + } }; connect(runControl, &RunControl::stopped, this, handleStop);