From 13c486bfc75b8a434981f756d518d3fbfebe7298 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 23 Apr 2012 16:03:10 +0200 Subject: Don't use the QRegExp methods that modify the object 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: I4f57d8df2e4de13aa95bb72da53c2565b38ae616 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Lars Knoll --- tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests/auto/qscriptjstestsuite') diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp index 1526c24..ffb5739 100644 --- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp +++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp @@ -413,7 +413,8 @@ bool tst_QScriptJSTestSuite::isExpectedFailure(const QString &fileName, const QS QString *message, FailureItem::Action *action) const { for (int i = 0; i < expectedFailures.size(); ++i) { - if (expectedFailures.at(i).pathRegExp.indexIn(fileName) != -1) { + QRegExp pathRegExp = expectedFailures.at(i).pathRegExp; + if (pathRegExp.indexIn(fileName) != -1) { if (description == expectedFailures.at(i).description) { if (message) *message = expectedFailures.at(i).message; @@ -439,7 +440,8 @@ void tst_QScriptJSTestSuite::addFileExclusion(const QRegExp &rx, const QString & bool tst_QScriptJSTestSuite::isExcludedFile(const QString &fileName, QString *message) const { for (int i = 0; i < fileExclusions.size(); ++i) { - if (fileExclusions.at(i).first.indexIn(fileName) != -1) { + QRegExp copy = fileExclusions.at(i).first; + if (copy.indexIn(fileName) != -1) { if (message) *message = fileExclusions.at(i).second; return true; -- cgit v1.2.1