qt5base-lts/tests/auto/corelib
Sona Kurazyan 24dedaeaa1 QFuture: fix handling of cancelled continuation chain
To support cancellation of continuations attached via the parent future,
for each future returned by a continuation we store a pointer to its
parent (i.e. future the continuation is attached to). Later, before
executing a continuation, we go through chain of parents and check if
any of them is cancelled. However, if one of the parents is destroyed
while the chain is executing, the next continuations' parent pointers
will become invalid. So storing the parent pointers isn't safe.

This commit changes the logic of handling the cancelled continuation
chain in the following way:

- Instead of storing a parent pointer in the continuation future's data,
  we do the opposite: we store a pointer to continuation's future in the
  parent.
- When a future is cancelled, we mark all continuation futures in the
  chain with a flag indicating that the chain is cancelled.
- To guarantee that the pointers to continuation future's data don't
  become invalid, we clean the continuation (that stores a copy of its
  future's data and keeps it alive) only when the associated promise
  is destructed, instead of cleaning it after the continuation is run.

Fixes: QTBUG-105182
Fixes: QTBUG-106083
Pick-to: 6.2 6.3 6.4
Change-Id: I48afa98152672c0fc737112be4ca3b1b42f6ed30
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-21 01:18:31 +02:00
..
animation Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
global QWinRegistryKey: refactor 2022-09-14 09:31:41 +08:00
io tst_qprocess: remove unused loop counter 2022-09-20 19:09:31 +02:00
itemmodels QtBase tests: remove QT_DISABLE_DEPRECATED_UP_TO defines 2022-08-24 22:08:49 +02:00
kernel Remove preprocessor conditionals for chrono include 2022-09-16 08:09:05 +02:00
mimetypes Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
platform Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
plugin Move QMacAutoReleasePool from qglobal.h to qcore_mac_p.h 2022-09-01 13:26:30 +02:00
serialization QTextStream: Fix logical error in setEncoding 2022-09-07 01:09:31 +02:00
text tst_QLocale: use fenv everywhere 2022-09-15 23:41:51 +02:00
thread QFuture: fix handling of cancelled continuation chain 2022-09-21 01:18:31 +02:00
time Tidy up tst_QTimeZone 2022-09-14 17:46:39 +02:00
tools Disable bad tests relying on wrong behavior 2022-09-15 12:07:02 +02:00
CMakeLists.txt Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00