Commit 20db17e4 authored by Ulf Hermann's avatar Ulf Hermann

Debugger: Only use random QML port if none was given

Change-Id: Ice80ac46d5b8a0f24fa3b18ad8197b360fb6361f
Task-number: QTCREATORBUG-16708
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 428f3f4c
......@@ -434,17 +434,19 @@ static DebuggerRunControl *doCreate(DebuggerRunParameters rp, RunConfiguration *
if (rp.languages & QmlLanguage) {
if (rp.device && rp.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
QTcpServer server;
const bool canListen = server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6);
if (!canListen) {
errors->append(DebuggerPlugin::tr("Not enough free ports for QML debugging.") + ' ');
return 0;
if (rp.qmlServer.host.isEmpty() || !rp.qmlServer.port.isValid()) {
QTcpServer server;
const bool canListen = server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6);
if (!canListen) {
errors->append(DebuggerPlugin::tr("Not enough free ports for QML debugging.") + ' ');
return 0;
}
TcpServerConnection conn;
conn.host = server.serverAddress().toString();
conn.port = Utils::Port(server.serverPort());
rp.qmlServer = conn;
}
TcpServerConnection conn;
conn.host = server.serverAddress().toString();
conn.port = Utils::Port(server.serverPort());
rp.qmlServer = conn;
// Makes sure that all bindings go through the JavaScript engine, so that
// breakpoints are actually hit!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment