From e3c16259ed5297a3ee707d0aeade985ae103992e Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 20 Nov 2015 15:56:26 +0100 Subject: [PATCH] QmlProfiler: When showing connection error, cancel any connects The device can exist without being open, which makes the disconnect() when the message box finishes ineffective. Also, disconnect() merely trashes the signals and slots, but doesn't remove the device. Task-number: QTCREATORBUG-15383 Change-Id: I8eb8ca3db496c9841156c0949c3e3bfd92329056 Reviewed-by: Christian Stenger --- src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp index 04f2ac0eb62..a355955f5bd 100644 --- a/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerclientmanager.cpp @@ -245,6 +245,8 @@ void QmlProfilerClientManager::tryToConnect() } else if (d->connectionAttempts == 50) { d->connectionTimer.stop(); d->connectionAttempts = 0; + delete d->connection; // delete directly. + d->connection = 0; QMessageBox *infoBox = QmlProfilerTool::requestMessageBox(); infoBox->setIcon(QMessageBox::Critical); @@ -300,14 +302,11 @@ void QmlProfilerClientManager::logState(const QString &msg) void QmlProfilerClientManager::retryMessageBoxFinished(int result) { - if (d->connection) { - QTC_ASSERT(!d->connection->isOpen(), return); - if (d->connection->isConnecting()) - d->connection->disconnect(); - } + QTC_ASSERT(!d->connection, disconnectClient()); switch (result) { case QMessageBox::Retry: { + connectClient(d->tcpPort); d->connectionAttempts = 0; d->connectionTimer.start(); break;