Revert "QRegularExpression: lock a mutex only if there's actual work to do"

Blunder -- two threads may step into this method together,
both see not studied, and both study (with one leaking its study data).

This reverts commit 5fbd787cf9a72621d66604a4898f06ea4365226e.

Change-Id: Ia746925abcad1e43adf4f6f1d495b018de022b07
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
bb10
Giuseppe D'Angelo 2014-07-13 16:22:49 +02:00
parent 12a4db710e
commit e7665fd8e4
1 changed files with 2 additions and 2 deletions

View File

@ -1149,11 +1149,11 @@ void QRegularExpressionPrivate::optimizePattern(OptimizePatternOption option)
{
Q_ASSERT(compiledPattern);
QMutexLocker lock(&mutex);
if (studyData.load()) // already optimized
return;
QMutexLocker lock(&mutex);
if ((option == LazyOptimizeOption) && (++usedCount != qt_qregularexpression_optimize_after_use_count))
return;