summaryrefslogtreecommitdiffstats
path: root/src/concurrent
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-01-24 15:57:07 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2022-01-24 22:40:35 +0100
commit4cd8eeaf8c6a05f09bdbc92690b63f5233abdad0 (patch)
tree07f41861910db4c369d04e8e68742b9cc4abce89 /src/concurrent
parentdf0f8e036cdef59d596113c4acb450258aba11d3 (diff)
Fix memory leak in QtConcurrent::run when called with a NULL QThreadPool
QThreadPool automatically deletes the runnable after it finishes running the task. In case QThreadPool is nullptr, we should delete the runnable manually. This amends 87b93c29be02f0a7ff9424b5e2b6431e20bd4c40. Pick-to: 6.3 6.2 5.15 Change-Id: Id7e4ed3d4d6de05990edf62e4099852983debc64 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/concurrent')
-rw-r--r--src/concurrent/qtconcurrentrunbase.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/concurrent/qtconcurrentrunbase.h b/src/concurrent/qtconcurrentrunbase.h
index 4870362146..e21f636700 100644
--- a/src/concurrent/qtconcurrentrunbase.h
+++ b/src/concurrent/qtconcurrentrunbase.h
@@ -99,6 +99,7 @@ public:
} else {
promise.reportCanceled();
promise.reportFinished();
+ delete this;
}
return theFuture;
}