QThread/Unix: fix silly mistake: static was missing after refactoring

Amends commit 6763e25cbc16cf8c54ab9b1ef97030aab9bb0eec, which refactored
        static struct Cleanup {

to move the body if said cleaning up closer to the rest of the clean up
code in QThreadDataDestroyer::EarlyMainThread. But it accidentally
forgot the static keyword. As a result, we attempted to clean up before
::currentThreadData was set yet, resulting in a no-op and no clean up.

Task-number: QTBUG-135044
Task-number: QTBUG-134080
Task-number: QTBUG-133861
Task-number: QTBUG-132697
Task-number: QTBUG-102984
Task-number: QTBUG-132381
Pick-to: dev 6.9 6.8
Change-Id: Ibe40567bba8dea205401fffdb71f7e6a3be130e4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Thiago Macieira 2025-03-24 16:47:33 -07:00
parent c63c918f3a
commit b5e47fa433

View File

@ -243,7 +243,7 @@ static void set_thread_data(QThreadData *data) noexcept
// As noted above: one global static for the thread that called
// ::exit() (which may not be a Qt thread) and the pthread_key_t for
// all others.
QThreadDataDestroyer::EarlyMainThread currentThreadCleanup;
static QThreadDataDestroyer::EarlyMainThread currentThreadCleanup;
pthread_setspecific(threadDataDestroyer.key, data);
}
currentThreadData = data;