diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2009-08-10 11:15:20 (GMT) |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2009-08-13 12:41:46 (GMT) |
commit | b5b29ba7744c6fc44ae2ac3f7c86dd424e9cf021 (patch) | |
tree | bb6d94c8238ca3eff8e5e19ef9f1510fcdc6d041 /src | |
parent | b800d684b9c807eb13359d78710df6a1da9ce44a (diff) | |
download | Qt-b5b29ba7744c6fc44ae2ac3f7c86dd424e9cf021.zip Qt-b5b29ba7744c6fc44ae2ac3f7c86dd424e9cf021.tar.gz Qt-b5b29ba7744c6fc44ae2ac3f7c86dd424e9cf021.tar.bz2 |
Wait for connections to remote debugging interface
The tcp server was waiting for connections right when instantiated ...
even before the different debugging services could register themselves.
This is fixed by first letting the different services register, and
only block for incoming connections when explicitly registered
(QmlDebugService::waitForConnectons).
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/debugger/qmldebugservice.cpp | 24 | ||||
-rw-r--r-- | src/declarative/debugger/qmldebugservice.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlengine.cpp | 2 |
3 files changed, 21 insertions, 7 deletions
diff --git a/src/declarative/debugger/qmldebugservice.cpp b/src/declarative/debugger/qmldebugservice.cpp index 9725494..3576a94 100644 --- a/src/declarative/debugger/qmldebugservice.cpp +++ b/src/declarative/debugger/qmldebugservice.cpp @@ -57,6 +57,7 @@ class QmlDebugServer : public QObject Q_DISABLE_COPY(QmlDebugServer) public: static QmlDebugServer *instance(); + void wait(); private slots: void readyRead(); @@ -72,8 +73,9 @@ class QmlDebugServerPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QmlDebugServer) public: QmlDebugServerPrivate(); - void init(int port); + void wait(); + int port; QTcpSocket *connection; QPacketProtocol *protocol; QHash<QString, QmlDebugService *> plugins; @@ -95,7 +97,7 @@ QmlDebugServerPrivate::QmlDebugServerPrivate() { } -void QmlDebugServerPrivate::init(int port) +void QmlDebugServerPrivate::wait() { Q_Q(QmlDebugServer); QTcpServer server; @@ -151,17 +153,20 @@ QmlDebugServer *QmlDebugServer::instance() server = new QmlDebugServer(port); } - if (server && server->d_func()->connection) - return server; - else - return 0; + return server; +} + +void QmlDebugServer::wait() +{ + Q_D(QmlDebugServer); + d->wait(); } QmlDebugServer::QmlDebugServer(int port) : QObject(*(new QmlDebugServerPrivate)) { Q_D(QmlDebugServer); - d->init(port); + d->port = port; } void QmlDebugServer::readyRead() @@ -354,6 +359,11 @@ QString QmlDebugService::objectToString(QObject *obj) return rv; } +void QmlDebugService::waitForClients() +{ + QmlDebugServer::instance()->wait(); +} + void QmlDebugService::sendMessage(const QByteArray &message) { Q_D(QmlDebugService); diff --git a/src/declarative/debugger/qmldebugservice.h b/src/declarative/debugger/qmldebugservice.h index b1344c4..c3c3b01 100644 --- a/src/declarative/debugger/qmldebugservice.h +++ b/src/declarative/debugger/qmldebugservice.h @@ -70,6 +70,8 @@ public: static bool isDebuggingEnabled(); static QString objectToString(QObject *obj); + static void waitForClients(); + protected: virtual void enabledChanged(bool); virtual void messageReceived(const QByteArray &); diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 5a10c3b..ce2a2ee 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -164,6 +164,8 @@ void QmlEnginePrivate::init() qmlEngineDebugServer(); isDebugging = true; QmlEngineDebugServer::addEngine(q); + + qmlEngineDebugServer()->waitForClients(); } } |