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: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
Kai Koehne
2012-03-22 13:00:56 +01:00
committed by Aurindam Jana
parent e412a93006
commit b6cb86eb53

View File

@@ -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,
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()
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)
{ {
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;
if (state() == EngineRunRequested
&& !d->m_automaticConnect)
beginConnection(port); 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);