summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-01-20 13:19:28 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-01-21 00:53:49 +0100
commit664c56d6b184b37546acc93128a692fa1bea7c3e (patch)
tree31b0ec15c03a59782638af538b996ebf422ba76d /src/corelib/thread
parent0f5a1725a00b3efbf90c462c691a298ea9ff5f94 (diff)
Work-around crash in QThreadPool QThread usage
This works around mismatch in threads starting and restarting QThreads, and is safe since we don't need to establish a binding, and objectName access in QThreadPool is locked behind a mutex. Pick-to: 6.3 6.2 Fixes: QTBUG-96718 Change-Id: Id3f75e4f8344796ca658899645219fe3373ddd6d Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r--src/corelib/thread/qthread_unix.cpp4
-rw-r--r--src/corelib/thread/qthread_win.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 32cada5e9d..ed3f3f68be 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -735,7 +735,9 @@ void QThread::start(Priority priority)
else
pthread_attr_setthreadname(&attr, objectName().toLocal8Bit());
#else
- d->objectName = objectName();
+ // avoid interacting with the binding system
+ d->objectName = d->extraData ? d->extraData->objectName.valueBypassingBindings()
+ : QString();
#endif
pthread_t threadId;
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index 6249b94ea2..cda5fe4de1 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -420,7 +420,9 @@ void QThread::start(Priority priority)
if (d->running)
return;
- d->objectName = objectName();
+ // avoid interacting with the binding system
+ d->objectName = d->extraData ? d->extraData->objectName.valueBypassingBindings()
+ : QString();
d->running = true;
d->finished = false;
d->exited = false;