summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-08-09 15:59:31 -0600
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-08-09 15:59:31 -0600
commit1c2f876c83afcb6dbbf830b3fe368eab86838552 (patch)
tree921c41b4b4d21ce3d08780dc424157dfa2e4fe96
parenta7c40cd33ba99658ac0c8849622a2b3f3db16de2 (diff)
downloadsink-1c2f876c83afcb6dbbf830b3fe368eab86838552.tar.gz
sink-1c2f876c83afcb6dbbf830b3fe368eab86838552.zip
Avoid warning
setFuture can emit signals directly if the future is already stopped. This does not apply to our case but it fixes the warning. "QFutureWatcher::connect: connecting after calling setFuture() is likely to produce race"
-rw-r--r--common/asyncutils.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/asyncutils.h b/common/asyncutils.h
index 67b5928..c80af30 100644
--- a/common/asyncutils.h
+++ b/common/asyncutils.h
@@ -31,12 +31,12 @@ KAsync::Job<T> run(const std::function<T()> &f, bool runAsync = true)
31 return KAsync::start<T>([f](KAsync::Future<T> &future) { 31 return KAsync::start<T>([f](KAsync::Future<T> &future) {
32 auto result = QtConcurrent::run(f); 32 auto result = QtConcurrent::run(f);
33 auto watcher = new QFutureWatcher<T>; 33 auto watcher = new QFutureWatcher<T>;
34 watcher->setFuture(result);
35 QObject::connect(watcher, &QFutureWatcher<T>::finished, watcher, [&future, watcher]() { 34 QObject::connect(watcher, &QFutureWatcher<T>::finished, watcher, [&future, watcher]() {
36 future.setValue(watcher->future().result()); 35 future.setValue(watcher->future().result());
37 delete watcher; 36 delete watcher;
38 future.setFinished(); 37 future.setFinished();
39 }); 38 });
39 watcher->setFuture(result);
40 }); 40 });
41 } else { 41 } else {
42 return KAsync::start<T>([f]() { 42 return KAsync::start<T>([f]() {