qtbase/tests/auto/gui/kernel
Thiago Macieira 1da7558bfd QThread/Unix: revert to pthread destruction instead of thread_local
Amends 65093a84c2, which changed how we
destroyed the main thread's QThreadData. This merges the call to
destroy_current_thread_data() for both types of Unix systems: those with
broken thread_local destructors and those with working ones. It turns
out that the function got called too early for us in those working
systems (see updated comment).

The clean up of the QThreadData is split into two different mechanisms:
 * for any auxiliary thread, when it exits, PThread will call back to
   destroy_current_thread_data()
 * for the thread that called ::exit(), PThread won't, but ::exit() will
   invoke set_thread_data()::TlsKey's destructor

This is different from the situation that existed prior to commit
65093a84c2b94b1543fd4593bc45d491951d28d4: first, there's no code in
qcoreapplication.cpp for this (all in qthread_unix.cpp). Second one may
call ::exit() from any thread, whether that is the thread that called
main(), the thread Qt thinks is theMainThread, or any other.

This commit moves the tst_QCoreApplication check for no extant objects
to a new test. I've chosen to add a new test instead of running a helper
binary via QProcess because we do have a couple of !QT_CONFIG(process)
platforms in the CI, and this is too important.

Credit to OSS-Fuzz for finding this, though it is not itself a fuzzying
problem (all tests of a given structure were crashing on exit).

Fixes: QTBUG-132381
Task-number: QTBUG-130895
Task-number: QTBUG-129927
Task-number: QTBUG-129846
Task-number: QTBUG-130341
Task-number: QTBUG-117996
Pick-to: 6.9 6.8
Change-Id: Ie294dce7263b4189f89ffffd9155ec71d31b89d9
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-01-06 17:48:27 -03:00
..
noqteventloop Change license for tests files 2024-02-04 09:56:42 +01:00
qaction Change license for tests files 2024-02-04 09:56:42 +01:00
qactiongroup Change license for tests files 2024-02-04 09:56:42 +01:00
qaddpostroutine Change license for tests files 2024-02-04 09:56:42 +01:00
qbackingstore tests: extend tst_QBackingStore::flush() 2024-08-11 10:14:42 +02:00
qclipboard Change license for tests files 2024-02-04 09:56:42 +01:00
qcursor Change license for tests files 2024-02-04 09:56:42 +01:00
qdrag Change license for tests files 2024-02-04 09:56:42 +01:00
qevent QtCore: use Qt::TimerId methods 2024-08-31 18:38:47 +03:00
qfileopenevent Tests: Reduce the number of module includes 2024-11-04 19:17:47 +01:00
qguiapplication QThread/Unix: revert to pthread destruction instead of thread_local 2025-01-06 17:48:27 -03:00
qguichronotimer Add QChronoTimer, a timer with nanoseconds precision 2024-03-03 19:56:55 +02:00
qguieventdispatcher tst_QEventDispatcher: port to QTEST_THROW_ON_FAIL 2024-06-18 06:54:27 +02:00
qguieventloop CMake: Make gui tests standalone projects 2023-07-05 15:09:32 +02:00
qguimetatype Change license for tests files 2024-02-04 09:56:42 +01:00
qguitimer tst_QTimer: refactor CMake code 2023-11-22 06:34:29 +02:00
qguivariant Change license for tests files 2024-02-04 09:56:42 +01:00
qhighdpi tst_qhighdpi: Write screen config to temporary directory 2024-08-15 10:37:20 +02:00
qinputdevice Change license for tests files 2024-02-04 09:56:42 +01:00
qinputmethod Change license for tests files 2024-02-04 09:56:42 +01:00
qkeyevent Change license for tests files 2024-02-04 09:56:42 +01:00
qkeysequence Change license for tests files 2024-02-04 09:56:42 +01:00
qmouseevent Change license for tests files 2024-02-04 09:56:42 +01:00
qmouseevent_modal Change license for tests files 2024-02-04 09:56:42 +01:00
qopenglwindow Change license for tests files 2024-02-04 09:56:42 +01:00
qpalette Change license for tests files 2024-02-04 09:56:42 +01:00
qpixelformat Change license for tests files 2024-02-04 09:56:42 +01:00
qrasterwindow Remove extra semi-colons 2024-02-06 20:17:18 +09:00
qscreen Change license for tests files 2024-02-04 09:56:42 +01:00
qshortcut Change license for tests files 2024-02-04 09:56:42 +01:00
qsurfaceformat Change license for tests files 2024-02-04 09:56:42 +01:00
qtouchevent Change license for tests files 2024-02-04 09:56:42 +01:00
qwindow tst_QWindow::framePositioning: Wait for window margins 2024-11-26 09:05:02 +00:00
CMakeLists.txt Add QChronoTimer, a timer with nanoseconds precision 2024-03-03 19:56:55 +02:00