qt6-bb10/tests/auto/corelib/kernel
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
..
qapplicationstatic Change license for tests files 2024-02-04 09:56:42 +01:00
qchronotimer QChronoTimer: remove static singleShot() functions 2024-08-29 20:41:50 +00:00
qcoreapplication QThread/Unix: do clean up the QAdoptedThread for the main thread 2024-11-15 03:17:29 -07:00
qdeadlinetimer tst_QDeadlineTimer: fix format-string in toString() implementation 2024-07-22 21:00:13 +00:00
qelapsedtimer QElapsedTimer: use new comparison helper macros 2024-05-14 00:32:34 +02:00
qeventdispatcher tst_QEventDispatcher: port to QTEST_THROW_ON_FAIL 2024-06-18 08:09:13 +00:00
qeventloop Change license for tests files 2024-02-04 09:56:42 +01:00
qjniarray JNI: Constrain QJniArray::toContainer to compatible target containers 2024-07-20 01:13:40 +00:00
qjnienvironment Change license for tests files 2024-02-04 09:56:42 +01:00
qjniobject JNI: Add test coverage for a jobjectArray in a native function 2024-09-02 18:10:38 +00:00
qjnitypes QJniObject: specialize the QtJniTypes::Traits to treat it like jobject 2024-07-20 01:13:11 +00:00
qmath Change license for tests files 2024-02-04 09:56:42 +01:00
qmetacontainer QMetaSequence and QMetaAssociation: use new comparison helper macros 2024-04-29 22:28:51 +02:00
qmetaenum QDebug: cast the QFlags value to the right-sized unsigned type (2/2) 2024-08-12 09:43:38 +00:00
qmetamethod QMetaMethod: use new comparison helper macros 2024-04-30 00:11:33 +02:00
qmetaobject Fix test compilation issues with QtLite configuration 2024-05-06 14:29:02 +00:00
qmetaobjectbuilder QMetaMethodBuilder: limit the bits of attribute()/setAttribute() 2024-10-29 20:51:12 +00:00
qmetaproperty Fix QFlag properties built by QMetaObjectBuilder 2024-10-29 20:51:12 +00:00
qmetatype QMetaType: use modern comparisons 2024-05-10 21:54:54 +02:00
qmimedata QMimeData: fix setData on URI list without ending CRLF 2024-04-22 13:57:38 -07:00
qobject tst_QObject: don't leak QtDeclarative::theData 2024-11-07 01:13:51 +00:00
qpermission Change license for tests files 2024-02-04 09:56:42 +01:00
qpointer QPointer: Use new comparison helper macros 2024-05-30 20:51:46 +02:00
qproperty Avoid referring to invalidated observer during binding evaluation 2024-10-07 17:26:50 +00:00
qsignalblocker Change license for tests files 2024-02-04 09:56:42 +01:00
qsignalmapper Change license for tests files 2024-02-04 09:56:42 +01:00
qsocketnotifier Change license for tests files 2024-02-04 09:56:42 +01:00
qtimer Timers: add Qt::TimerId enum class 2024-03-03 19:56:55 +02:00
qtranslator QTranslator: work around uiLanguages not including lang_Terr variants 2024-10-31 23:15:29 +02:00
qvariant qtypeinfo.h: move QTypeTraits part to qttypetraits.h 2024-06-04 13:42:16 +00:00
qwineventnotifier Change license for tests files 2024-02-04 09:56:42 +01:00
qwinregistrykey Replace QWinRegistryKey::dwordValue with QWinRegistryKey::value<T> 2024-11-09 20:00:08 +00:00
CMakeLists.txt Add QChronoTimer, a timer with nanoseconds precision 2024-03-03 19:56:55 +02:00