aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp12
-rw-r--r--tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp11
2 files changed, 13 insertions, 10 deletions
diff --git a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp
index 64b26bdd0d..6152853917 100644
--- a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp
+++ b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp
@@ -43,6 +43,8 @@
#include <QtCore/qplugin.h>
#include <QtNetwork/qlocalsocket.h>
+Q_DECLARE_METATYPE(QLocalSocket::LocalSocketError)
+
QT_BEGIN_NAMESPACE
@@ -133,8 +135,14 @@ bool QLocalClientConnection::connectToServer()
{
m_socket = new QLocalSocket;
m_socket->setParent(this);
- QObject::connect(m_socket, &QLocalSocket::connected,
- this, &QLocalClientConnection::connectionEstablished);
+ connect(m_socket, &QLocalSocket::connected,
+ this, &QLocalClientConnection::connectionEstablished);
+ connect(m_socket, static_cast<void(QLocalSocket::*)(QLocalSocket::LocalSocketError)>(
+ &QLocalSocket::error), m_socket, [this](QLocalSocket::LocalSocketError) {
+ m_socket->disconnectFromServer();
+ m_socket->connectToServer(m_filename);
+ }, Qt::QueuedConnection);
+
m_socket->connectToServer(m_filename);
qDebug("QML Debugger: Connecting to socket %s...", m_filename.toLatin1().constData());
return true;
diff --git a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
index a503da4e4b..8d21a8a45a 100644
--- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
+++ b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp
@@ -51,12 +51,6 @@ private:
QQmlDebugConnection *m_conn;
QQmlDebugTestService *m_service;
- bool connect();
-
-signals:
- void waiting();
- void parallel();
-
private slots:
void initTestCase();
@@ -75,12 +69,13 @@ void tst_QQmlDebugLocal::initTestCase()
const QString waitingMsg = QString("QML Debugger: Connecting to socket %1...").arg(fileName);
QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData());
+ QQmlDebuggingEnabler::connectToLocalDebugger(fileName);
+
+ QTest::qWait(1000);
m_conn = new QQmlDebugConnection(this);
m_conn->startLocalServer(fileName);
- QQmlDebuggingEnabler::connectToLocalDebugger(fileName);
-
new QQmlEngine(this);
QQmlDebugTestClient client("tst_QQmlDebugLocal::handshake()", m_conn);