From 38f77d09e89c93cedf6da4144fc8aafe95975891 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 14 Nov 2024 15:10:06 -0700 Subject: QThreadData: refactor current() now that it never returns null Simplying the body of the function to rely less on the exception handling too. The implementations for Unix and Windows are now literally identical, but duplicated because they call different static functions Change-Id: Ia14910a1c778ff5e606afffdabb8035e4603edda Reviewed-by: Thiago Macieira Reviewed-by: Fabian Kosmale --- src/corelib/thread/qthread.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/thread/qthread.cpp') diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 0574386dacd..f804ab8b9d3 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -1119,9 +1119,9 @@ void QThread::setTerminationEnabled(bool) // No threads: so we can just use static variables Q_CONSTINIT static QThreadData *data = nullptr; -QThreadData *QThreadData::current(bool createIfNecessary) +QThreadData *QThreadData::current() { - if (!data && createIfNecessary) { + if (!data) { data = new QThreadData; data->thread = new QAdoptedThread(data); } -- cgit v1.2.3