Commit b6cb86eb authored by Kai Koehne's avatar Kai Koehne Committed by Aurindam Jana
Browse files

QmlDebugger: Fix automatic connection setup



Make sure we only try to connect when we're in the right state
(EngineRunRequest). Specifically, stop to connect when the engine
is finished.

Change-Id: Ia4f1f79e8ac5b32ff436e63195516e242d4c120c
Reviewed-by: default avatarAurindam Jana <aurindam.jana@nokia.com>
parent e412a930
...@@ -120,14 +120,16 @@ private: ...@@ -120,14 +120,16 @@ private:
InteractiveInterpreter m_interpreter; InteractiveInterpreter m_interpreter;
bool m_validContext; bool m_validContext;
QHash<QString,BreakpointModelId> pendingBreakpoints; QHash<QString,BreakpointModelId> pendingBreakpoints;
bool m_retryOnConnectFail;
QList<quint32> queryIds; QList<quint32> queryIds;
bool m_retryOnConnectFail;
bool m_automaticConnect;
}; };
QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q) QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q)
: m_adapter(q), : m_adapter(q),
m_validContext(false), m_validContext(false),
m_retryOnConnectFail(false) m_retryOnConnectFail(false),
m_automaticConnect(false)
{} {}
class ASTWalker: public Visitor class ASTWalker: public Visitor
...@@ -369,6 +371,7 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters, ...@@ -369,6 +371,7 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
if (startParameters.useTerminal) { if (startParameters.useTerminal) {
d->m_noDebugOutputTimer.setInterval(0); d->m_noDebugOutputTimer.setInterval(0);
d->m_retryOnConnectFail = true; d->m_retryOnConnectFail = true;
d->m_automaticConnect = true;
} }
} }
...@@ -399,6 +402,9 @@ void QmlEngine::setupInferior() ...@@ -399,6 +402,9 @@ void QmlEngine::setupInferior()
QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state()); QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
notifyInferiorSetupOk(); notifyInferiorSetupOk();
if (d->m_automaticConnect)
beginConnection();
} }
void QmlEngine::appendMessage(const QString &msg, Utils::OutputFormat /* format */) void QmlEngine::appendMessage(const QString &msg, Utils::OutputFormat /* format */)
...@@ -423,12 +429,22 @@ void QmlEngine::tryToConnect(quint16 port) ...@@ -423,12 +429,22 @@ void QmlEngine::tryToConnect(quint16 port)
{ {
showMessage(QLatin1String("QML Debugger: No application output received in time, trying to connect ..."), LogStatus); showMessage(QLatin1String("QML Debugger: No application output received in time, trying to connect ..."), LogStatus);
d->m_retryOnConnectFail = true; d->m_retryOnConnectFail = true;
beginConnection(port); if (state() == EngineRunRequested
&& !d->m_automaticConnect)
beginConnection(port);
else
d->m_automaticConnect = true;
} }
void QmlEngine::beginConnection(quint16 port) void QmlEngine::beginConnection(quint16 port)
{ {
d->m_noDebugOutputTimer.stop(); d->m_noDebugOutputTimer.stop();
if (state() != EngineRunRequested && d->m_retryOnConnectFail)
return;
QTC_ASSERT(state() == EngineRunRequested, return)
if (port > 0) { if (port > 0) {
QTC_CHECK(startParameters().communicationChannel QTC_CHECK(startParameters().communicationChannel
== DebuggerStartParameters::CommunicationChannelTcpIp); == DebuggerStartParameters::CommunicationChannelTcpIp);
......
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