summaryrefslogtreecommitdiffstats
path: root/async
diff options
context:
space:
mode:
authorDan Vrátil <dvratil@redhat.com>2015-02-07 17:48:49 +0100
committerDan Vrátil <dvratil@redhat.com>2015-02-07 17:48:49 +0100
commit7a3ecf3d79ffd8d4c207b42625552da3d57589f5 (patch)
tree98ddff0920dc79efb66b60ded82f9b0bf0ac30bf /async
parentda0bcaf6469311f03ba35d48a4a405c95594a686 (diff)
downloadsink-7a3ecf3d79ffd8d4c207b42625552da3d57589f5.tar.gz
sink-7a3ecf3d79ffd8d4c207b42625552da3d57589f5.zip
AsyncTest: block until innerJob finishes to prevent crash
innerJob.exec() starts an async job, so once exec() returns, the innerJob will go out of scope and will be deleted, which however does not prevent the QTimer from invoking it's lambda slot, which will crash when dereferencing a deleted Future.
Diffstat (limited to 'async')
-rw-r--r--async/autotests/asynctest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/async/autotests/asynctest.cpp b/async/autotests/asynctest.cpp
index 6c4bbeb..9240d28 100644
--- a/async/autotests/asynctest.cpp
+++ b/async/autotests/asynctest.cpp
@@ -143,7 +143,7 @@ void AsyncTest::testNestedAsync()
143 future.setFinished(); 143 future.setFinished();
144 innerThenFuture.setFinished(); 144 innerThenFuture.setFinished();
145 }); 145 });
146 innerJob.exec(); 146 innerJob.exec().waitForFinished();
147 } 147 }
148 ).then<int, int>([&done](int result, Async::Future<int> &future) { 148 ).then<int, int>([&done](int result, Async::Future<int> &future) {
149 done = true; 149 done = true;