qt6-bb10/tests/auto/corelib
Marc Mutz 44d4d2593c tst_QPromise: don't rely on move-only lambdas
VxWorks, at least as used in the 6.8 CI, has a problem with move-only
lambdas passed to QThread::create(). This might have been the reason
for the resurrection of the cxx11_future feature in
408430a543ef605157963b1a894847c7ba9f9956.

This patch tries to work around the issue by not moving the promise
into the lambda capture, but caputuring it by reference, and then
moving it into a local stack variable. In all cases, the ThreadWrapper
is created after the promise, so, since the ThreadWrapper dtor join()s
(like jthread), the promise out-lives the thread, and the destruction
of the promise happens-after the join() with the thread. So, no data
races. Code mustn't touch the promise object from the main thread once
the ThreadWrapper has started, but that's the case already and the
test functions are small enough for any such future use to be obvious
in review.

Amends 385f0732d9 and
4e1b20893aeeb9580bc6b52ac4baea297675bfee.

It appears that dev no longer has the problem¹, but apply this to dev,
too, to maintain consistency with the test in last three LTS releases.

¹ 4e1b20893aeeb9580bc6b52ac4baea297675bfee passed, but its cherry-pick
  to 6.8 did not

Pick-to: 6.5 6.2
Change-Id: If1feba9d3a7f8677789d45fa9f4990cf44145709
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 4d6cf54664a98e01d4caab42431c62d6deb9f86e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2024-11-05 18:53:16 +00:00
..
animation Change license for tests files 2024-02-04 09:56:42 +01:00
global Tests: suppress has_denorm deprecation 2024-09-06 14:38:21 +00:00
io Tests: Reduce the number of module includes 2024-11-04 19:42:27 +00:00
ipc ipctestcommon.h: port away from qsnprintf() 2024-07-30 16:47:32 +00:00
itemmodels QConcatenateTablesProxyModel: react to row and column moves 2024-09-13 17:44:05 +00:00
kernel QTranslator: work around uiLanguages not including lang_Terr variants 2024-10-31 23:15:29 +02:00
mimetypes Update tika-mimetypes.xml from upstream 2024-08-29 04:16:36 +00:00
platform Android: Add tests for QtAbstractListModel 2024-09-19 17:54:39 +00:00
plugin QUuid: restore sorting order of Qt < 6.8 2024-10-22 13:15:24 +00:00
serialization Tests: suppress has_denorm deprecation 2024-09-06 14:38:21 +00:00
text tst_QChar: run it also under QT_RESTRICTED_CAST_FROM_ASCII 2024-10-28 16:30:11 +02:00
thread tst_QPromise: don't rely on move-only lambdas 2024-11-05 18:53:16 +00:00
time Address problems with date-time parsing near bounds 2024-10-22 18:53:18 +02:00
tools QList: fix std::to_address(QList::iterator) on older compilers 2024-10-29 01:10:27 +00:00
CMakeLists.txt tests: Remove remains of qmake conversion from CMakeLists.txt files 2023-02-17 21:56:49 +01:00