summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qthread_unix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/thread/qthread_unix.cpp')
-rw-r--r--src/corelib/thread/qthread_unix.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 567c936..d2a824a 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -124,7 +124,14 @@ QThreadData *QThreadData::current()
} else {
data = new QThreadData;
pthread_setspecific(current_thread_data_key, data);
- data->thread = new QAdoptedThread(data);
+ QT_TRY {
+ data->thread = new QAdoptedThread(data);
+ } QT_CATCH(...) {
+ pthread_setspecific(current_thread_data_key, 0);
+ data->deref();
+ data = 0;
+ QT_RETHROW;
+ }
data->deref();
}
if (!QCoreApplicationPrivate::theMainThread)