From 727039c8e832b30775190683bf0aa4c293ddf7cd Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 17 Aug 2012 10:57:15 +0200 Subject: [PATCH] QThreadPool: fix race on 'queue' in stealRunnable() The code under mutex protection already implicitly handles the case where queue.empty(), so just removing the pre-lock check suffices. Change-Id: I01467aff62e61bb4efd16359dd64546ff51c6bad Reviewed-by: Olivier Goffart --- src/corelib/thread/qthreadpool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index a923b8a..1c3672b 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -314,7 +314,7 @@ bool QThreadPoolPrivate::waitForDone(int msecs) */ void QThreadPoolPrivate::stealRunnable(QRunnable *runnable) { - if (runnable == 0 || queue.isEmpty()) + if (runnable == 0) return; bool found = false; { -- 2.7.4