QmlDebugger: Fixing QmlCppEngine for failed setup due to timed out connection

This commit is contained in:
Christiaan Janssen
2010-11-16 16:17:16 +01:00
parent da84000313
commit d992b223f6
2 changed files with 18 additions and 13 deletions

View File

@@ -83,10 +83,8 @@ QmlCppEngine::QmlCppEngine(const DebuggerStartParameters &sp)
QmlCppEngine::~QmlCppEngine() QmlCppEngine::~QmlCppEngine()
{ {
if (d->m_qmlEngine) delete d->m_qmlEngine;
delete d->m_qmlEngine; delete d->m_cppEngine;
if (d->m_cppEngine)
delete d->m_cppEngine;
} }
void QmlCppEngine::editorChanged(Core::IEditor *editor) void QmlCppEngine::editorChanged(Core::IEditor *editor)
@@ -483,7 +481,7 @@ void QmlCppEngine::shutdownInferior()
{ {
if (!checkErrorState(InferiorShutdownFailed)) { if (!checkErrorState(InferiorShutdownFailed)) {
if (d->m_cppEngine->state() == InferiorStopOk) { if (d->m_cppEngine->state() == InferiorStopOk) {
d->m_cppEngine->shutdownInferior(); d->m_cppEngine->quitDebugger();
} else { } else {
notifyInferiorShutdownOk(); notifyInferiorShutdownOk();
} }
@@ -499,13 +497,19 @@ void QmlCppEngine::initEngineShutdown()
d->m_cppEngine->quitDebugger(); d->m_cppEngine->quitDebugger();
} else } else
if (state() == EngineSetupRequested) { if (state() == EngineSetupRequested) {
if (!checkErrorState(EngineSetupFailed)) { if (!runControl() || d->m_errorState == EngineSetupFailed) {
notifyEngineSetupFailed();
} else {
notifyEngineSetupOk(); notifyEngineSetupOk();
} }
} else } else
if (state() == InferiorStopRequested) { if (state() == InferiorStopRequested) {
checkErrorState(InferiorStopFailed); checkErrorState(InferiorStopFailed);
} else { } else
if (state() == InferiorShutdownRequested && !checkErrorState(InferiorShutdownFailed)) {
notifyInferiorShutdownOk();
} else
if (state() != DebuggerFinished) {
quitDebugger(); quitDebugger();
} }
} }
@@ -518,11 +522,6 @@ void QmlCppEngine::shutdownEngine()
} }
} }
void QmlCppEngine::setupSlaveEngineOnTimer()
{
QTimer::singleShot(0, this, SLOT(setupSlaveEngine()));
}
void QmlCppEngine::setupSlaveEngine() void QmlCppEngine::setupSlaveEngine()
{ {
if (d->m_qmlEngine->state() == DebuggerNotReady) if (d->m_qmlEngine->state() == DebuggerNotReady)
@@ -620,6 +619,13 @@ void QmlCppEngine::engineStateChanged(const DebuggerState &newState)
} }
break; break;
case EngineShutdownRequested:
// we have to abort the setup before the sub-engines die
// because we depend on an active runcontrol that will be shut down by the dying engine
if (state() == EngineSetupRequested)
notifyEngineSetupFailed();
break;
case DebuggerFinished: case DebuggerFinished:
initEngineShutdown(); initEngineShutdown();
break; break;

View File

@@ -107,7 +107,6 @@ private slots:
void editorChanged(Core::IEditor *editor); void editorChanged(Core::IEditor *editor);
private: private:
void setupSlaveEngineOnTimer();
void initEngineShutdown(); void initEngineShutdown();
bool checkErrorState(const DebuggerState stateToCheck); bool checkErrorState(const DebuggerState stateToCheck);
void engineStateChanged(const DebuggerState &newState); void engineStateChanged(const DebuggerState &newState);