From 2a683c1f14897a04886ba1ad3df44b17d98ce8be Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 20 Apr 2012 14:59:30 +0200 Subject: [PATCH] Don't use the QRegExp methods that modify the object [QtTest] QRegExp matching methods modify the object, which we don't want to. In particular, when we receive a QRegExp from the user or we store in a context that might require thread-safety, make sure we make a copy before using it. QRegularExpression has no such shortcoming. Task-number: QTBUG-25064 Change-Id: I7c5f5ebf4521c32337c9ea9aeeef50e1e8690bf8 Reviewed-by: Rohan McGovern Reviewed-by: Jason McDonald --- src/testlib/qbenchmarkvalgrind.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/testlib/qbenchmarkvalgrind.cpp b/src/testlib/qbenchmarkvalgrind.cpp index 453c5ccda0..c4a4990a36 100644 --- a/src/testlib/qbenchmarkvalgrind.cpp +++ b/src/testlib/qbenchmarkvalgrind.cpp @@ -66,7 +66,7 @@ bool QBenchmarkValgrindUtils::haveValgrind() if (!process.waitForFinished(-1)) return false; const QByteArray out = process.readAllStandardOutput(); - const QRegExp rx(QLatin1String("^valgrind-([0-9]).([0-9]).[0-9]")); + QRegExp rx(QLatin1String("^valgrind-([0-9]).([0-9]).[0-9]")); if (rx.indexIn(QLatin1String(out.data())) == -1) return false; bool ok; @@ -110,7 +110,7 @@ qint64 QBenchmarkValgrindUtils::extractResult(const QString &fileName) qint64 val = -1; bool valSeen = false; - const QRegExp rxValue(QLatin1String("^summary: (\\d+)")); + QRegExp rxValue(QLatin1String("^summary: (\\d+)")); while (!file.atEnd()) { const QString line(QLatin1String(file.readLine())); if (rxValue.indexIn(line) != -1) { @@ -139,7 +139,7 @@ QString QBenchmarkValgrindUtils::getNewestFileName() int hiSuffix = -1; QFileInfo lastFileInfo; const QString pattern = QString::fromLatin1("%1.(\\d+)").arg(base); - const QRegExp rx(pattern); + QRegExp rx(pattern); foreach (QFileInfo fileInfo, fiList) { const int index = rx.indexIn(fileInfo.fileName()); Q_ASSERT(index == 0);