src/declarative/debugger/qdeclarativedebugservice.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
--- a/src/declarative/debugger/qdeclarativedebugservice.cpp	Tue Jul 06 15:10:48 2010 +0300
+++ b/src/declarative/debugger/qdeclarativedebugservice.cpp	Wed Aug 18 10:37:55 2010 +0300
@@ -61,6 +61,7 @@
 public:
     static QDeclarativeDebugServer *instance();
     void listen();
+    void waitForConnection();
     bool hasDebuggingClient() const;
 
 private Q_SLOTS:
@@ -115,6 +116,12 @@
         qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port);
 }
 
+void QDeclarativeDebugServer::waitForConnection()
+{
+    Q_D(QDeclarativeDebugServer);
+    d->tcpServer->waitForNewConnection(-1);
+}
+
 void QDeclarativeDebugServer::newConnection()
 {
     Q_D(QDeclarativeDebugServer);
@@ -144,6 +151,7 @@
     if (!envTested) {
         envTested = true;
         QByteArray env = qgetenv("QML_DEBUG_SERVER_PORT");
+        QByteArray block = qgetenv("QML_DEBUG_SERVER_BLOCK");
 
         bool ok = false;
         int port = env.toInt(&ok);
@@ -151,6 +159,9 @@
         if (ok && port > 1024) {
             server = new QDeclarativeDebugServer(port);
             server->listen();
+            if (!block.isEmpty()) {
+                server->waitForConnection();
+            }
         }
     }