Commit 7991b204 authored by Aurindam Jana's avatar Aurindam Jana Committed by Qt by Nokia
Browse files

DeclarativeDebug: Clear service name when returning from waitForMessage

The service name is cleared in waitForMessage instead of receiveMessage
so that consequent packets can de delivered to the service. A flag is
used to check if the operation succeeded.

Change-Id: I45b94a6194026d22ffb75a394628c7497ce4704e
Reviewed-on: http://codereview.qt.nokia.com/3486


Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent 1253db60
No related merge requests found
Showing with 7 additions and 3 deletions
...@@ -91,6 +91,7 @@ public: ...@@ -91,6 +91,7 @@ public:
QStringList clientPlugins; QStringList clientPlugins;
bool gotHello; bool gotHello;
QString waitingForMsgFromService; QString waitingForMsgFromService;
bool waitingForMsgSucceeded;
private: private:
// private slot // private slot
...@@ -100,7 +101,8 @@ private: ...@@ -100,7 +101,8 @@ private:
QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() : QDeclarativeDebugServerPrivate::QDeclarativeDebugServerPrivate() :
connection(0), connection(0),
gotHello(false) gotHello(false),
waitingForMsgSucceeded(false)
{ {
} }
...@@ -313,7 +315,7 @@ void QDeclarativeDebugServer::receiveMessage(const QByteArray &message) ...@@ -313,7 +315,7 @@ void QDeclarativeDebugServer::receiveMessage(const QByteArray &message)
if (d->waitingForMsgFromService == name) { if (d->waitingForMsgFromService == name) {
// deliver directly so that it is delivered before waitForMessage is returning. // deliver directly so that it is delivered before waitForMessage is returning.
d->_q_deliverMessage(name, message); d->_q_deliverMessage(name, message);
d->waitingForMsgFromService.clear(); d->waitingForMsgSucceeded = true;
} else { } else {
// deliver message in next event loop run. // deliver message in next event loop run.
// Fixes the case that the service does start it's own event loop ..., // Fixes the case that the service does start it's own event loop ...,
...@@ -403,11 +405,13 @@ bool QDeclarativeDebugServer::waitForMessage(QDeclarativeDebugService *service) ...@@ -403,11 +405,13 @@ bool QDeclarativeDebugServer::waitForMessage(QDeclarativeDebugService *service)
|| !d->waitingForMsgFromService.isEmpty()) || !d->waitingForMsgFromService.isEmpty())
return false; return false;
d->waitingForMsgSucceeded = false;
d->waitingForMsgFromService = service->name(); d->waitingForMsgFromService = service->name();
do { do {
d->connection->waitForMessage(); d->connection->waitForMessage();
} while (!d->waitingForMsgFromService.isEmpty()); } while (!d->waitingForMsgSucceeded);
d->waitingForMsgFromService.clear();
return true; return true;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment