Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QThread/Unix: do clean up the QAdoptedThread for the main thread
Commit 1ed0dd8 ("QThread/Unix: make QThreadPrivate::finish() be called much later") introduced this problem. Commit 4fabde3 split the thread termination in two phases, but did not fix this. This re-applies commit 950b35c ("Clear the current thread data for the main thread"), which was reverted in commit 7dc6222 ("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 <[email protected]> (cherry picked from commit 65093a8)
- Loading branch information