QmlEngine: Fix crash when trying to connect

Since we directly called beginConnection in connectionStartupFailed
we got a stack overflow over time. Instead, only try to connect
every 3 seconds.

Also remove special logic for mixed debugging: They should behave
the same (except maybe where you're breaking inside QQmlDebugServer,
but that's a corner case).

Change-Id: Idf2f55e3d905a01065c123c708b50dbb88388d1f
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
This commit is contained in:
Kai Koehne
2012-03-16 12:55:00 +01:00
parent 126d0af4d6
commit fdbdf2d14f

View File

@@ -364,7 +364,10 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
SLOT(documentUpdated(QmlJS::Document::Ptr))); SLOT(documentUpdated(QmlJS::Document::Ptr)));
// we won't get any debug output // we won't get any debug output
d->m_retryOnConnectFail = startParameters.useTerminal; if (startParameters.useTerminal) {
d->m_noDebugOutputTimer.setInterval(0);
d->m_retryOnConnectFail = true;
}
} }
QmlEngine::~QmlEngine() QmlEngine::~QmlEngine()
@@ -416,6 +419,7 @@ void QmlEngine::connectionEstablished()
void QmlEngine::tryToConnect(quint16 port) void QmlEngine::tryToConnect(quint16 port)
{ {
showMessage(QLatin1String("QML Debugger: No application output received in time, trying to connect ..."), LogStatus);
d->m_retryOnConnectFail = true; d->m_retryOnConnectFail = true;
beginConnection(port); beginConnection(port);
} }
@@ -447,15 +451,9 @@ void QmlEngine::beginConnection(quint16 port)
void QmlEngine::connectionStartupFailed() void QmlEngine::connectionStartupFailed()
{ {
if (isSlaveEngine()) {
if (masterEngine()->state() != InferiorRunOk) {
// we're right now debugging C++, just try longer ...
beginConnection();
return;
}
}
if (d->m_retryOnConnectFail) { if (d->m_retryOnConnectFail) {
beginConnection(); // retry after 3 seconds ...
QTimer::singleShot(3000, this, SLOT(beginConnection()));
return; return;
} }