qt6-bb10/tests/auto/corelib
Thiago Macieira dce6ef8fac QThread/Unix: do clean up the QAdoptedThread for the main thread
Commit 1ed0dd88a3 ("QThread/Unix: make
QThreadPrivate::finish() be called much later") introduced this problem.
Commit 4fabde349f16b59f37568da2a4c050c6dd53a34e split the thread
termination in two phases, but did not fix this.

This re-applies commit 950b35cf97 ("Clear
the current thread data for the main thread"), which was reverted in
commit 7dc622290b ("Make sure QThreadData
and QAdoptedThread object is destroyed at app exit"), both from Qt 5.1.

Between Qt 5.1 and 6.7, the responsibility of clearing the
QAdoptedThread for the main thread was split: it could occur either in
~QCoreApplicationData if exit() was called in that thread or in
~QThreadData() if it wasn't (e.g., when the Qt "main thread" is not
main()'s thread):
  * frame #0: 0x0000000101db8a28 QtCore`QAdoptedThread::~QAdoptedThread(this=0x000060000176c070) at qthread.cpp:139:1
    frame #1: 0x0000000101db81eb QtCore`QThreadData::~QThreadData(this=0x0000600002468000) at qthread.cpp:82:5
    frame #2: 0x0000000101db8379 QtCore`QThreadData::~QThreadData(this=0x0000600002468000) at qthread.cpp:57:1
    frame #3: 0x0000000101db841c QtCore`QThreadData::deref(this=0x0000600002468000) at qthread.cpp:108:9
    frame #4: 0x0000000101f4ec79 QtCore`destroy_current_thread_data(p=0x0000600002468000) at qthread_unix.cpp:104:11

This commit centralizes and gives ~QThreadData() the exclusive
responsibility.  That requires not resetting QThreadData::threadId so
~QThreadData can know it is theMainThread.

Fixes: QTBUG-130895
Task-number: QTBUG-129927
Task-number: QTBUG-129846
Task-number: QTBUG-130341
Task-number: QTBUG-117996
Change-Id: Ie3f3cbdc5523837b505cfffd95fba5e6498b5069
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 65093a84c2b94b1543fd4593bc45d491951d28d4)
2024-11-15 03:17:29 -07:00
..
animation
global Tests: suppress has_denorm deprecation 2024-09-06 14:38:21 +00:00
io Replace QWinRegistryKey::dwordValue with QWinRegistryKey::value<T> 2024-11-09 20:00:08 +00:00
ipc Add REUSE.toml files 2024-11-07 08:38:49 +01:00
itemmodels QConcatenateTablesProxyModel: react to row and column moves 2024-09-13 17:44:05 +00:00
kernel QThread/Unix: do clean up the QAdoptedThread for the main thread 2024-11-15 03:17:29 -07:00
mimetypes Add REUSE.toml files 2024-11-07 08:38:49 +01: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 Add REUSE.toml files 2024-11-07 08:38:49 +01:00
text Add REUSE.toml files 2024-11-07 08:38:49 +01:00
thread tst_QPromise: complete the port to RUN_TEST_FUNC 2024-11-13 18:04:25 +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