From b5e47fa433f218a47db98a370fbad97c70455e85 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 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 --- 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 7d80f6e364f..137fa957dfc 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -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;