summaryrefslogtreecommitdiff
path: root/tests/auto/qscriptjstestsuite
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-04-23 16:03:10 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-24 14:39:21 +0200
commit13c486bfc75b8a434981f756d518d3fbfebe7298 (patch)
treeb62e8de23544a47537b11009a0c3f625cf4ac08f /tests/auto/qscriptjstestsuite
parent8b65d84145f0f415d0963caa7b49da07ac67148d (diff)
downloadqtscript-13c486bfc75b8a434981f756d518d3fbfebe7298.tar.gz
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 <dangelog@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto/qscriptjstestsuite')
-rw-r--r--tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp6
1 files changed, 4 insertions, 2 deletions
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;