diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2020-10-09 11:01:16 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2020-10-13 17:04:16 +0200 |
commit | ba511b2fa4782d6618a5261bbbd50f0c57266a3a (patch) | |
tree | 62dd28d3ce8a8fd540e50726b648c989be818424 /src/corelib/thread/qpromise.qdoc | |
parent | 1ae15edd7e7ec4bd96d3a9a4d6b5793c7f7e8830 (diff) |
Reject overwrites by the same index in QPromise::addResult()
One can call addResult(value, index) twice and consequently set the
value twice by the same index. This seems rather strange and probably
should not be allowed. This commit rejects setting results when there's
already a valid result by that index. Consequently, this fixes memory
leaks caused by N-times-called addResult(..., index)
Fixes: QTBUG-86828
Change-Id: I77494f2cb73ce727ffad721cfcdcaa420899eb25
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src/corelib/thread/qpromise.qdoc')
-rw-r--r-- | src/corelib/thread/qpromise.qdoc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/thread/qpromise.qdoc b/src/corelib/thread/qpromise.qdoc index 9c7925da95..4b7b497b3f 100644 --- a/src/corelib/thread/qpromise.qdoc +++ b/src/corelib/thread/qpromise.qdoc @@ -112,6 +112,9 @@ Adds \a result to the internal result collection at \a index position. If index is unspecified, \a result is added to the end of the collection. + \note addResult() rejects \a result if there's already another result in the + collection stored at the same index. + You can get a result at a specific index by calling QFuture::resultAt(). \note It is possible to specify an arbitrary index and request result at |