diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2011-09-29 10:12:15 (GMT) |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2011-09-29 13:21:43 (GMT) |
commit | 739e705150ad114eb92a1fac34a51d30322ffc31 (patch) | |
tree | 5f121ac2c6414ff6587fd1dd45f48ab11751a85b /src | |
parent | 2a1e6ef9d3f519d9109672b593dae07821e1c043 (diff) | |
download | Qt-739e705150ad114eb92a1fac34a51d30322ffc31.zip Qt-739e705150ad114eb92a1fac34a51d30322ffc31.tar.gz Qt-739e705150ad114eb92a1fac34a51d30322ffc31.tar.bz2 |
QDeclarativeDebug: Fix autotest breakage in qdeclarativedebugjs
In case a service is waiting for messages via waitForMessage, deliver
all arriving messages to the service directly, not only the first one.
In the case of QDeclarativeDebugJS::watchExpressions() test case,
the first message is actually WATCH_EXPRESSIONS , followed by
BREAKPOINTS. However, the second BREAKPOINTS command wasn't
delivered directly, but queued in the main event loop. As soon as
waitForMessage() was returning, QJSDebugClient was just calling
waitForMessage() anew (because BREAKPOINTS wasn't delivered yet),
blocking the main event loop from being run.
Reviewed-by: Aurindam Jana
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/debugger/qdeclarativedebugserver.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index 12691b2..3e0c326 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -91,6 +91,7 @@ public: QStringList clientPlugins; bool gotHello; QString waitingForMsgFromService; + bool waitingForMsgSucceeded; private: // private slot @@ -100,7 +101,8 @@ private: QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() : connection(0), - gotHello(false) + gotHello(false), + waitingForMsgSucceeded(false) { } @@ -315,7 +317,7 @@ void QDeclarativeDebugServer::receiveMessage(const QByteArray &message) if (d->waitingForMsgFromService == name) { // deliver directly so that it is delivered before waitForMessage is returning. d->_q_deliverMessage(name, message); - d->waitingForMsgFromService.clear(); + d->waitingForMsgSucceeded = true; } else { // deliver message in next event loop run. // Fixes the case that the service does start it's own event loop ..., @@ -409,7 +411,9 @@ bool QDeclarativeDebugServer::waitForMessage(QDeclarativeDebugService *service) do { d->connection->waitForMessage(); - } while (!d->waitingForMsgFromService.isEmpty()); + } while (!d->waitingForMsgSucceeded); + d->waitingForMsgSucceeded = false; + d->waitingForMsgFromService.clear(); return true; } |