summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdiriterator.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-04-20 14:59:30 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-27 22:52:54 +0200
commitda2c170aa25bc6e8fd6cd0788fae14ee455ce359 (patch)
treef0e605c55b1d9f32c60a97c03eba909cfbfc012b /src/corelib/io/qdiriterator.cpp
parentd78d5ddf2ac5433b09dad2658f810e9de767dfea (diff)
Don't use the QRegExp methods that modify the object [QtCore]
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: Icf22986cd5f6fd086518c78a7d56e6cadfe9f5f6 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/io/qdiriterator.cpp')
-rw-r--r--src/corelib/io/qdiriterator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp
index f2a259be64..67ea1c9538 100644
--- a/src/corelib/io/qdiriterator.cpp
+++ b/src/corelib/io/qdiriterator.cpp
@@ -338,7 +338,8 @@ bool QDirIteratorPrivate::matchesFilters(const QString &fileName, const QFileInf
end = nameRegExps.constEnd();
iter != end; ++iter) {
- if (iter->exactMatch(fileName)) {
+ QRegExp copy = *iter;
+ if (copy.exactMatch(fileName)) {
matched = true;
break;
}