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 <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2012-08-17 10:57:15 +02:00 committed by Qt by Nokia
parent d0ae7bef48
commit 727039c8e8

View File

@ -314,7 +314,7 @@ bool QThreadPoolPrivate::waitForDone(int msecs)
*/ */
void QThreadPoolPrivate::stealRunnable(QRunnable *runnable) void QThreadPoolPrivate::stealRunnable(QRunnable *runnable)
{ {
if (runnable == 0 || queue.isEmpty()) if (runnable == 0)
return; return;
bool found = false; bool found = false;
{ {