diff --git a/src/plugins/debugger/qml/qmlcppengine.cpp b/src/plugins/debugger/qml/qmlcppengine.cpp
index f8913f4049134f3bdae9a0ed66dc78441c8b2a7a..02687b21867134eadd879caabad3e13c8b99727b 100644
--- a/src/plugins/debugger/qml/qmlcppengine.cpp
+++ b/src/plugins/debugger/qml/qmlcppengine.cpp
@@ -92,6 +92,7 @@ private:
     QmlEngine *m_qmlEngine;
     DebuggerEngine *m_cppEngine;
     DebuggerEngine *m_activeEngine;
+    QList<DebuggerEngine*> m_enginesAwaitingRemoteSetup;
     int m_stackBoundary;
 };
 
@@ -154,8 +155,9 @@ QmlCppEngine::QmlCppEngine(const DebuggerStartParameters &sp,
     connect(d->m_qmlEngine->stackHandler(), SIGNAL(stackChanged()),
             d, SLOT(qmlStackChanged()), Qt::QueuedConnection);
     connect(d->m_cppEngine, SIGNAL(stackFrameCompleted()), this, SIGNAL(stackFrameCompleted()));
-    connect(d->m_cppEngine, SIGNAL(requestRemoteSetup()), this, SIGNAL(requestRemoteSetup()));
     connect(d->m_qmlEngine, SIGNAL(stackFrameCompleted()), this, SIGNAL(stackFrameCompleted()));
+    connect(d->m_cppEngine, SIGNAL(requestRemoteSetup()), this, SLOT(slaveEngineRequestedRemoteSetup()));
+    connect(d->m_qmlEngine, SIGNAL(requestRemoteSetup()), this, SLOT(slaveEngineRequestedRemoteSetup()));
 }
 
 QmlCppEngine::~QmlCppEngine()
@@ -462,6 +464,19 @@ void QmlCppEngine::notifyInferiorShutdownOk()
     DebuggerEngine::notifyInferiorShutdownOk();
 }
 
+void QmlCppEngine::slaveEngineRequestedRemoteSetup()
+{
+    DebuggerEngine *slaveEngine = qobject_cast<DebuggerEngine*>(sender());
+    QTC_ASSERT(slaveEngine, return);
+
+    bool emitRequest = d->m_enginesAwaitingRemoteSetup.isEmpty();
+    d->m_enginesAwaitingRemoteSetup << slaveEngine;
+
+    if (emitRequest) {
+        emit requestRemoteSetup();
+    }
+}
+
 void QmlCppEngine::setupInferior()
 {
     EDEBUG("\nMASTER SETUP INFERIOR");
@@ -659,15 +674,17 @@ void QmlCppEngine::slaveEngineStateChanged
 void QmlCppEngine::handleRemoteSetupDone(int gdbServerPort, int qmlPort)
 {
     EDEBUG("MASTER REMOTE SETUP DONE");
-    d->m_qmlEngine->startParameters().qmlServerPort = qmlPort;
-    d->m_cppEngine->handleRemoteSetupDone(gdbServerPort, qmlPort);
+    foreach (DebuggerEngine *slaveEngine, d->m_enginesAwaitingRemoteSetup)
+        slaveEngine->handleRemoteSetupDone(gdbServerPort, qmlPort);
+    d->m_enginesAwaitingRemoteSetup.clear();
 }
 
 void QmlCppEngine::handleRemoteSetupFailed(const QString &message)
 {
     EDEBUG("MASTER REMOTE SETUP FAILED");
-    d->m_qmlEngine->handleRemoteSetupFailed(message);
-    d->m_cppEngine->handleRemoteSetupFailed(message);
+    foreach (DebuggerEngine *slaveEngine, d->m_enginesAwaitingRemoteSetup)
+        slaveEngine->handleRemoteSetupFailed(message);
+    d->m_enginesAwaitingRemoteSetup.clear();
 }
 
 void QmlCppEngine::showMessage(const QString &msg, int channel, int timeout) const
diff --git a/src/plugins/debugger/qml/qmlcppengine.h b/src/plugins/debugger/qml/qmlcppengine.h
index a01ac4ef6556e11c62184a02e05b93dbcf1a8459..2b3b01bf6aef018557bc2764e5a828a5983d56ee 100644
--- a/src/plugins/debugger/qml/qmlcppengine.h
+++ b/src/plugins/debugger/qml/qmlcppengine.h
@@ -124,6 +124,9 @@ protected:
     void notifyEngineRunAndInferiorRunOk();
     void notifyInferiorShutdownOk();
 
+private slots:
+    void slaveEngineRequestedRemoteSetup();
+
 private:
     void engineStateChanged(DebuggerState newState);
     void setState(DebuggerState newState, bool forced = false);