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
parent
12a4db710e
commit
e7665fd8e4
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue