path: root/src
diff options
authorThiago Macieira <>2012-04-20 14:59:30 +0200
committerQt by Nokia <>2012-04-25 20:15:32 +0200
commit6624151c6a8772a3f01a291f744ea72b469106fc (patch)
treebdd1ba126da722b6967eecf7fd90b1830b810792 /src
parent066da57a122de26e8a71ab1eaca0ea205c876bdf (diff)
Don't use the QRegExp methods that modify the object [QtWidgets]
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: I44cc44b75b3da10c5ece97cb6315c2c425327dc0 Reviewed-by: Alexis Menard <> Reviewed-by: Lars Knoll <>
Diffstat (limited to 'src')
1 files changed, 2 insertions, 1 deletions
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index a7ae4b366b..40cc100c53 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -2017,7 +2017,8 @@ bool QFileSystemModelPrivate::passNameFilters(const QFileSystemNode *node) const
// Check the name regularexpression filters
if (!(node->isDir() && (filters & QDir::AllDirs))) {
for (int i = 0; i < nameFilters.size(); ++i) {
- if (>fileName))
+ QRegExp copy =;
+ if (copy.exactMatch(node->fileName))
return true;
return false;