forked from qt-creator/qt-creator
Debugger: Only use random QML port if none was given
This is a cherry-pick of 20db17e4f0
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 <christian.stenger@qt.io>
This commit is contained in:
@@ -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!
|
||||
|
Reference in New Issue
Block a user