diff options
Diffstat (limited to 'common/clientapi.h')
-rw-r--r-- | common/clientapi.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/common/clientapi.h b/common/clientapi.h index d860305..3ff8472 100644 --- a/common/clientapi.h +++ b/common/clientapi.h | |||
@@ -137,6 +137,10 @@ public: | |||
137 | //We must guarantee that the emitter is returned before the first result is emitted. | 137 | //We must guarantee that the emitter is returned before the first result is emitted. |
138 | //The result provider must be threadsafe. | 138 | //The result provider must be threadsafe. |
139 | async::run([query, resultSet](){ | 139 | async::run([query, resultSet](){ |
140 | QEventLoop eventLoop; | ||
141 | resultSet->onDone([&eventLoop](){ | ||
142 | eventLoop.quit(); | ||
143 | }); | ||
140 | // Query all resources and aggregate results | 144 | // Query all resources and aggregate results |
141 | KAsync::iterate(getResources(query.resources)) | 145 | KAsync::iterate(getResources(query.resources)) |
142 | .template each<void, QByteArray>([query, resultSet](const QByteArray &resource, KAsync::Future<void> &future) { | 146 | .template each<void, QByteArray>([query, resultSet](const QByteArray &resource, KAsync::Future<void> &future) { |
@@ -158,10 +162,6 @@ public: | |||
158 | 162 | ||
159 | //Keep the thread alive until the result is ready | 163 | //Keep the thread alive until the result is ready |
160 | if (!resultSet->isDone()) { | 164 | if (!resultSet->isDone()) { |
161 | QEventLoop eventLoop; | ||
162 | resultSet->onDone([&eventLoop](){ | ||
163 | eventLoop.quit(); | ||
164 | }); | ||
165 | eventLoop.exec(); | 165 | eventLoop.exec(); |
166 | } | 166 | } |
167 | }); | 167 | }); |