From 614847eae99bd4b6ce375f9f5572acfb3b513307 Mon Sep 17 00:00:00 2001 From: Sona Kurazyan Date: Tue, 18 Jan 2022 13:07:43 +0100 Subject: Use QPromise when creating continuations to avoid memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Continuations were using QFutureInterface to create and return the associated future to the user. Attaching a continuation to the returned future could cause memory leaks (described in an earlier commit). Use a QPromise when saving the continuation, to make sure that the attached continuation is cleaned in the destructor of the associated QPromise, so that it doesn't keep any ref-counted copies to the shared data, thus preventing it from being deleted. Task-number: QTBUG-99534 Pick-to: 6.3 6.2 Change-Id: I52d5501292095d41d1e060b7dd140c8e5d01335c Reviewed-by: Andrei Golubev Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Edward Welbourne --- tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/benchmarks/corelib/thread') diff --git a/tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp b/tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp index 17c2f20712..686bb76bdb 100644 --- a/tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp +++ b/tests/benchmarks/corelib/thread/qfuture/tst_bench_qfuture.cpp @@ -30,6 +30,7 @@ #include #include +#include #include class tst_QFuture : public QObject -- cgit v1.2.3