summaryrefslogtreecommitdiffstats
path: root/async/src
diff options
context:
space:
mode:
Diffstat (limited to 'async/src')
-rw-r--r--async/src/async.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/async/src/async.h b/async/src/async.h
index 73eeaa0..a72d058 100644
--- a/async/src/async.h
+++ b/async/src/async.h
@@ -718,14 +718,14 @@ void EachExecutor<PrevOut, Out, In>::run(const ExecutionPtr &execution)
718 } 718 }
719 719
720 for (auto arg : prevFuture->value()) { 720 for (auto arg : prevFuture->value()) {
721 Async::Future<Out> future; 721 //We have to manually manage the lifetime of these temporary futures
722 EachExecutor<PrevOut, Out, In>::mFunc(arg, future); 722 Async::Future<Out> *future = new Async::Future<Out>();
723 EachExecutor<PrevOut, Out, In>::mFunc(arg, *future);
723 auto fw = new Async::FutureWatcher<Out>(); 724 auto fw = new Async::FutureWatcher<Out>();
724 mFutureWatchers.append(fw); 725 mFutureWatchers.append(fw);
725 QObject::connect(fw, &Async::FutureWatcher<Out>::futureReady, 726 QObject::connect(fw, &Async::FutureWatcher<Out>::futureReady,
726 [out, fw, this]() { 727 [out, fw, this, future]() {
727 auto future = fw->future(); 728 assert(fw->future().isFinished());
728 assert(future.isFinished());
729 const int index = mFutureWatchers.indexOf(fw); 729 const int index = mFutureWatchers.indexOf(fw);
730 assert(index > -1); 730 assert(index > -1);
731 mFutureWatchers.removeAt(index); 731 mFutureWatchers.removeAt(index);
@@ -734,8 +734,9 @@ void EachExecutor<PrevOut, Out, In>::run(const ExecutionPtr &execution)
734 out->setFinished(); 734 out->setFinished();
735 } 735 }
736 delete fw; 736 delete fw;
737 delete future;
737 }); 738 });
738 fw->setFuture(future); 739 fw->setFuture(*future);
739 } 740 }
740} 741}
741 742