From 7a3ecf3d79ffd8d4c207b42625552da3d57589f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Sat, 7 Feb 2015 17:48:49 +0100 Subject: 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. --- async/autotests/asynctest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'async') 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() future.setFinished(); innerThenFuture.setFinished(); }); - innerJob.exec(); + innerJob.exec().waitForFinished(); } ).then([&done](int result, Async::Future &future) { done = true; -- cgit v1.2.3