From 1c2f876c83afcb6dbbf830b3fe368eab86838552 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 9 Aug 2017 15:59:31 -0600 Subject: 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" --- common/asyncutils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 run(const std::function &f, bool runAsync = true) return KAsync::start([f](KAsync::Future &future) { auto result = QtConcurrent::run(f); auto watcher = new QFutureWatcher; - watcher->setFuture(result); QObject::connect(watcher, &QFutureWatcher::finished, watcher, [&future, watcher]() { future.setValue(watcher->future().result()); delete watcher; future.setFinished(); }); + watcher->setFuture(result); }); } else { return KAsync::start([f]() { -- cgit v1.2.3