FutureScheduler: fix possible race, connect before setFuture

This commit is contained in:
xiphon 2019-12-19 00:29:21 +00:00
parent 3d7ded209a
commit 3ea329e45f

View file

@ -50,10 +50,10 @@ private:
try
{
auto *watcher = newWatcher<T>();
watcher->setFuture(makeFuture(watcher));
connect(watcher, &QFutureWatcher<T>::finished, [this, watcher] {
watcher->deleteLater();
});
watcher->setFuture(makeFuture(watcher));
return qMakePair(true, watcher->future());
}
catch (const std::exception &exception)