diff options
| author | Javier <dev.git@javispedro.com> | 2014-12-03 01:47:48 +0100 |
|---|---|---|
| committer | Javier <dev.git@javispedro.com> | 2014-12-03 01:47:48 +0100 |
| commit | 8d98f990c9ed158d8c65befc154ab58a3c392646 (patch) | |
| tree | 594fe7c19c600fafb321e7cf084a515fed42fb66 /daemon/watchconnector.cpp | |
| parent | 132562620764a8c0cc01dcc1574003beaa70272f (diff) | |
fix some appmsg issues
Diffstat (limited to 'daemon/watchconnector.cpp')
| -rw-r--r-- | daemon/watchconnector.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/daemon/watchconnector.cpp b/daemon/watchconnector.cpp index dd95821..baec52c 100644 --- a/daemon/watchconnector.cpp +++ b/daemon/watchconnector.cpp @@ -109,13 +109,17 @@ bool WatchConnector::dispatchMessage(uint endpoint, const QByteArray &data) if (tmp_it != tmpHandlers.end()) { QList<EndpointHandlerFunc>& funcs = tmp_it.value(); bool ok = false; - if (!funcs.empty()) { - if (funcs.first()(data)) { + for (int i = 0; i < funcs.size(); i++) { + if (funcs[i](data)) { + // This handler accepted this message ok = true; - funcs.removeFirst(); + // Since it is a temporary handler, remove it. + funcs.removeAt(i); + break; } } if (funcs.empty()) { + // "Garbage collect" the tmpHandlers entry. tmpHandlers.erase(tmp_it); } if (ok) { |
