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 <christian.stenger@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-11-20 15:56:26 +01:00
parent f710ec8ce2
commit e3c16259ed

View File

@@ -245,6 +245,8 @@ void QmlProfilerClientManager::tryToConnect()
} else if (d->connectionAttempts == 50) { } else if (d->connectionAttempts == 50) {
d->connectionTimer.stop(); d->connectionTimer.stop();
d->connectionAttempts = 0; d->connectionAttempts = 0;
delete d->connection; // delete directly.
d->connection = 0;
QMessageBox *infoBox = QmlProfilerTool::requestMessageBox(); QMessageBox *infoBox = QmlProfilerTool::requestMessageBox();
infoBox->setIcon(QMessageBox::Critical); infoBox->setIcon(QMessageBox::Critical);
@@ -300,14 +302,11 @@ void QmlProfilerClientManager::logState(const QString &msg)
void QmlProfilerClientManager::retryMessageBoxFinished(int result) void QmlProfilerClientManager::retryMessageBoxFinished(int result)
{ {
if (d->connection) { QTC_ASSERT(!d->connection, disconnectClient());
QTC_ASSERT(!d->connection->isOpen(), return);
if (d->connection->isConnecting())
d->connection->disconnect();
}
switch (result) { switch (result) {
case QMessageBox::Retry: { case QMessageBox::Retry: {
connectClient(d->tcpPort);
d->connectionAttempts = 0; d->connectionAttempts = 0;
d->connectionTimer.start(); d->connectionTimer.start();
break; break;