diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-04-18 12:17:54 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-04-18 12:17:54 +0200 |
commit | 5ea80b625764810a4b741041ae5dcbb6f5af3805 (patch) | |
tree | 449da711026be08cda7b7f4356a503828f38e58e | |
parent | a35acab8ecdadb5547c445a41ca2a67d978ed4a6 (diff) | |
download | sink-5ea80b625764810a4b741041ae5dcbb6f5af3805.tar.gz sink-5ea80b625764810a4b741041ae5dcbb6f5af3805.zip |
Avoid error while processing messagequeue
Only process while we have messages available.
-rw-r--r-- | dummyresource/resourcefactory.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/dummyresource/resourcefactory.cpp b/dummyresource/resourcefactory.cpp index 679bba2..d5765e2 100644 --- a/dummyresource/resourcefactory.cpp +++ b/dummyresource/resourcefactory.cpp | |||
@@ -176,6 +176,11 @@ private slots: | |||
176 | //Async::foreach("pass iterator here").parallel("process value here").join(); | 176 | //Async::foreach("pass iterator here").parallel("process value here").join(); |
177 | return Async::dowhile( | 177 | return Async::dowhile( |
178 | [this, queue](Async::Future<bool> &future) { | 178 | [this, queue](Async::Future<bool> &future) { |
179 | if (queue->isEmpty()) { | ||
180 | future.setValue(false); | ||
181 | future.setFinished(); | ||
182 | return; | ||
183 | } | ||
179 | queue->dequeue( | 184 | queue->dequeue( |
180 | [this, &future](void *ptr, int size, std::function<void(bool success)> messageQueueCallback) { | 185 | [this, &future](void *ptr, int size, std::function<void(bool success)> messageQueueCallback) { |
181 | auto callback = [messageQueueCallback, &future](bool success) { | 186 | auto callback = [messageQueueCallback, &future](bool success) { |