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: 6.8
Change-Id: Ibe40567bba8dea205401fffdb71f7e6a3be130e4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit b5e47fa433f218a47db98a370fbad97c70455e85)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 08325952eeb3a5cc9410a1b45e3445e97af51941)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Thiago Macieira 2025-03-24 16:47:33 -07:00 committed by Qt Cherry-pick Bot
parent 8e9b6f32c0
commit 5bfbc3f173

View File

@ -244,7 +244,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;