diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 4 | ||||
-rw-r--r-- | src/corelib/thread/qthread_p.h | 2 | ||||
-rw-r--r-- | src/corelib/thread/qthread_unix.cpp | 4 | ||||
-rw-r--r-- | src/corelib/thread/qthread_win.cpp | 4 |
4 files changed, 8 insertions, 6 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index f1351f5a07..5819443d3c 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2086,7 +2086,9 @@ void QObject::deleteLater() const char *qFlagLocation(const char *method) { - QThreadData::current()->flaggedSignatures.store(method); + QThreadData *currentThreadData = QThreadData::current(false); + if (currentThreadData != 0) + currentThreadData->flaggedSignatures.store(method); return method; } diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 8429e41433..fce84e881b 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -223,7 +223,7 @@ public: QThreadData(int initialRefCount = 1); ~QThreadData(); - static QThreadData *current(); + static QThreadData *current(bool createIfNecessary = true); static void clearCurrentThreadData(); static QThreadData *get2(QThread *thread) { Q_ASSERT_X(thread != 0, "QThread", "internal error"); return thread->d_func()->data; } diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 15558cb148..b838cb4b28 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -215,10 +215,10 @@ void QThreadData::clearCurrentThreadData() clear_thread_data(); } -QThreadData *QThreadData::current() +QThreadData *QThreadData::current(bool createIfNecessary) { QThreadData *data = get_thread_data(); - if (!data) { + if (!data && createIfNecessary) { data = new QThreadData; QT_TRY { set_thread_data(data); diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 037343c996..865b1e6af5 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -101,11 +101,11 @@ void QThreadData::clearCurrentThreadData() TlsSetValue(qt_current_thread_data_tls_index, 0); } -QThreadData *QThreadData::current() +QThreadData *QThreadData::current(bool createIfNecessary) { qt_create_tls(); QThreadData *threadData = reinterpret_cast<QThreadData *>(TlsGetValue(qt_current_thread_data_tls_index)); - if (!threadData) { + if (!threadData && createIfNecessary) { threadData = new QThreadData; // This needs to be called prior to new AdoptedThread() to // avoid recursion. |