QmlProfiler: Don't try to reconnect while already connecting

Hanging connection attempts will be aborted in response to the
"retry" message box now.

Change-Id: I63775eed9d7677a62293ba5c96a43e839ba285b4
Task-number: QTCREATORBUG-14685
Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Ulf Hermann
2015-07-06 14:33:49 +02:00
parent 6c9c0efc09
commit 2ee019b46f
3 changed files with 11 additions and 1 deletions

View File

@@ -295,6 +295,11 @@ bool QmlDebugConnection::isOpen() const
return d->gotHello; return d->gotHello;
} }
bool QmlDebugConnection::isConnecting() const
{
return !isOpen() && d->device;
}
void QmlDebugConnection::close() void QmlDebugConnection::close()
{ {
if (d->device && d->device->isOpen()) if (d->device && d->device->isOpen())

View File

@@ -57,6 +57,7 @@ public:
void connectToHost(const QString &hostName, quint16 port); void connectToHost(const QString &hostName, quint16 port);
bool isOpen() const; bool isOpen() const;
bool isConnecting() const;
void close(); void close();
signals: signals:

View File

@@ -215,7 +215,7 @@ void QmlProfilerClientManager::disconnectClientSignals()
void QmlProfilerClientManager::connectToClient() void QmlProfilerClientManager::connectToClient()
{ {
if (!d->connection || d->connection->isOpen()) if (!d->connection || d->connection->isOpen() || d->connection->isConnecting())
return; return;
d->connection->connectToHost(d->tcpHost, d->tcpPort); d->connection->connectToHost(d->tcpHost, d->tcpPort);
@@ -290,6 +290,10 @@ void QmlProfilerClientManager::logState(const QString &msg)
void QmlProfilerClientManager::retryMessageBoxFinished(int result) void QmlProfilerClientManager::retryMessageBoxFinished(int result)
{ {
QTC_ASSERT(!d->connection->isOpen(), return);
if (d->connection->isConnecting())
d->connection->disconnect();
switch (result) { switch (result) {
case QMessageBox::Retry: { case QMessageBox::Retry: {
d->connectionAttempts = 0; d->connectionAttempts = 0;