diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-24 09:28:50 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-24 15:02:29 (GMT) |
commit | 68e5673bb1ca080bbaf5cf7198fcf2deafa60772 (patch) | |
tree | 11e0fb9b40a6437d227681411257c8d1b06a6409 /src | |
parent | 7d11b50933ad6cfaebda1190d8d8b9ba470c8013 (diff) | |
download | Qt-68e5673bb1ca080bbaf5cf7198fcf2deafa60772.zip Qt-68e5673bb1ca080bbaf5cf7198fcf2deafa60772.tar.gz Qt-68e5673bb1ca080bbaf5cf7198fcf2deafa60772.tar.bz2 |
QThreadStorage: fix crash if thread local destructor reset himself
Regression in ed8f3b6c98f1b305f0d183bc70c5f810a9c45ef2 (QTBUG-14579)
WebKit ThreadSpecific implementation does that.
See the comment in ThreadSpecific<T>::destroy(void*)
Reveiwed-by: Brad
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/thread/qthreadstorage.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/thread/qthreadstorage.cpp b/src/corelib/thread/qthreadstorage.cpp index 07d940f..416fcfb 100644 --- a/src/corelib/thread/qthreadstorage.cpp +++ b/src/corelib/thread/qthreadstorage.cpp @@ -201,6 +201,11 @@ void QThreadStorageData::finish(void **p) continue; } destructor(q); //crash here might mean the thread exited after qthreadstorage was destroyed + + if (tls->size() > i) { + //re reset the tls in case it has been recreated by its own destructor. + (*tls)[i] = 0; + } } tls->clear(); } |