From 5bfbc3f1731a3c134780e4c7997022210963affe Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 24 Mar 2025 16:47:33 -0700 Subject: [PATCH] QThread/Unix: fix silly mistake: static was missing after refactoring MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit b5e47fa433f218a47db98a370fbad97c70455e85) Reviewed-by: MÃ¥rten Nordheim (cherry picked from commit 08325952eeb3a5cc9410a1b45e3445e97af51941) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/thread/qthread_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 2a5d53c6ff1..4213b020b69 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -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;