diff options
author | David Faure <david.faure@kdab.com> | 2013-03-18 15:19:44 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-22 16:44:51 +0100 |
commit | f4609b202208fe592d24c7ae3b4a48ee83045497 (patch) | |
tree | c9827efe74688595664c379085ba2a6267e49c13 /src/corelib/thread/qthread_p.h | |
parent | 85b25fc22176b574865813fa53f7eb2fcbdc89bf (diff) |
QThread: fix race when setting the eventDispatcher
Use QAtomicPointer to make this thread-safe.
Change-Id: If71f204699fcefabdb59bd26342d777d1cc9e2a7
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/thread/qthread_p.h')
-rw-r--r-- | src/corelib/thread/qthread_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 8e9eb1035a..7e963fdcd1 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -230,6 +230,8 @@ public: void ref(); void deref(); + inline bool hasEventDispatcher() const + { return eventDispatcher.load() != 0; } bool canWaitLocked() { @@ -241,7 +243,7 @@ public: Qt::HANDLE threadId; bool quitNow; int loopLevel; - QAbstractEventDispatcher *eventDispatcher; + QAtomicPointer<QAbstractEventDispatcher> eventDispatcher; QStack<QEventLoop *> eventLoops; QPostEventList postEventList; bool canWait; |