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: I252d1c47d7039caacec6aac5b572371d5b7efe32
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
if (keyRegExp.isEmpty())
return true;
+ QRegExp copy = keyRegExp;
foreach (const QString &key, keys) {
- if (keyRegExp.exactMatch(key))
+ if (copy.exactMatch(key))
return true;
}
return false;