summaryrefslogtreecommitdiffstats
path: root/async/src
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2015-04-03 16:34:05 +0200
committerDan Vrátil <dvratil@redhat.com>2015-04-04 20:44:17 +0200
commit9d0a8497f9693bccdd1c031104ea5837dc62e4ee (patch)
treed290a4a7970316dca9673db1f78609501798738d /async/src
parentffdbd257bc4b13132b10f60d9ab70759e1f259bd (diff)
downloadsink-9d0a8497f9693bccdd1c031104ea5837dc62e4ee.tar.gz
sink-9d0a8497f9693bccdd1c031104ea5837dc62e4ee.zip
Async: fix crash in Job::nestedJobWrapper
Diffstat (limited to 'async/src')
-rw-r--r--async/src/async.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/async/src/async.h b/async/src/async.h
index c6ca9e7..7425604 100644
--- a/async/src/async.h
+++ b/async/src/async.h
@@ -499,9 +499,14 @@ private:
499 auto job = otherJob; 499 auto job = otherJob;
500 FutureWatcher<OutOther> *watcher = new FutureWatcher<OutOther>(); 500 FutureWatcher<OutOther> *watcher = new FutureWatcher<OutOther>();
501 QObject::connect(watcher, &FutureWatcherBase::futureReady, 501 QObject::connect(watcher, &FutureWatcherBase::futureReady,
502 [watcher, &future]() { 502 [watcher, future]() {
503 Async::detail::copyFutureValue(watcher->future(), future); 503 // FIXME: We pass future by value, because using reference causes the
504 future.setFinished(); 504 // future to get deleted before this lambda is invoked, leading to crash
505 // in copyFutureValue()
506 // copy by value is const
507 auto outFuture = future;
508 Async::detail::copyFutureValue(watcher->future(), outFuture);
509 outFuture.setFinished();
505 delete watcher; 510 delete watcher;
506 }); 511 });
507 watcher->setFuture(job.exec(in ...)); 512 watcher->setFuture(job.exec(in ...));