Commit e84abe3a authored by Ulf Hermann's avatar Ulf Hermann

Debugger: Only use random QML port if none was given

This is a cherry-pick of 20db17e4 from
4.1. The problem also occurs in 4.0 and as another version of 4.0 might
be released, we should fix it there, too.

Change-Id: I3cf42abfa9d0ea5812495be6e2728264dc115ba9
Task-number: QTCREATORBUG-16708
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 252a3f89
......@@ -450,15 +450,18 @@ void DebuggerRunControlCreator::enrich(const RunConfiguration *runConfig, const
if (m_rp.languages & QmlLanguage) {
if (m_rp.device && m_rp.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE) {
if (m_rp.qmlServerAddress.isEmpty() || m_rp.qmlServerPort == InvalidPort) {
QTcpServer server;
const bool canListen = server.listen(QHostAddress::LocalHost)
|| server.listen(QHostAddress::LocalHostIPv6);
if (!canListen) {
m_errors.append(DebuggerPlugin::tr("Not enough free ports for QML debugging.") + QLatin1Char(' '));
m_errors.append(DebuggerPlugin::tr("Not enough free ports for QML debugging.")
+ QLatin1Char(' '));
return;
}
m_rp.qmlServerAddress = server.serverAddress().toString();
m_rp.qmlServerPort = server.serverPort();
}
// 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