From f4609b202208fe592d24c7ae3b4a48ee83045497 Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 18 Mar 2013 15:19:44 +0100 Subject: QThread: fix race when setting the eventDispatcher Use QAtomicPointer to make this thread-safe. Change-Id: If71f204699fcefabdb59bd26342d777d1cc9e2a7 Reviewed-by: Olivier Goffart --- src/corelib/thread/qthread_p.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib/thread/qthread_p.h') 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 eventDispatcher; QStack eventLoops; QPostEventList postEventList; bool canWait; -- cgit v1.2.3