forked from qt-creator/qt-creator
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:
@@ -295,6 +295,11 @@ bool QmlDebugConnection::isOpen() const
|
||||
return d->gotHello;
|
||||
}
|
||||
|
||||
bool QmlDebugConnection::isConnecting() const
|
||||
{
|
||||
return !isOpen() && d->device;
|
||||
}
|
||||
|
||||
void QmlDebugConnection::close()
|
||||
{
|
||||
if (d->device && d->device->isOpen())
|
||||
|
||||
@@ -57,6 +57,7 @@ public:
|
||||
void connectToHost(const QString &hostName, quint16 port);
|
||||
|
||||
bool isOpen() const;
|
||||
bool isConnecting() const;
|
||||
void close();
|
||||
|
||||
signals:
|
||||
|
||||
@@ -215,7 +215,7 @@ void QmlProfilerClientManager::disconnectClientSignals()
|
||||
|
||||
void QmlProfilerClientManager::connectToClient()
|
||||
{
|
||||
if (!d->connection || d->connection->isOpen())
|
||||
if (!d->connection || d->connection->isOpen() || d->connection->isConnecting())
|
||||
return;
|
||||
|
||||
d->connection->connectToHost(d->tcpHost, d->tcpPort);
|
||||
@@ -290,6 +290,10 @@ void QmlProfilerClientManager::logState(const QString &msg)
|
||||
|
||||
void QmlProfilerClientManager::retryMessageBoxFinished(int result)
|
||||
{
|
||||
QTC_ASSERT(!d->connection->isOpen(), return);
|
||||
if (d->connection->isConnecting())
|
||||
d->connection->disconnect();
|
||||
|
||||
switch (result) {
|
||||
case QMessageBox::Retry: {
|
||||
d->connectionAttempts = 0;
|
||||
|
||||
Reference in New Issue
Block a user