Don't use the QRegExp methods that modify the object [qmake]
authorThiago Macieira <thiago.macieira@intel.com>
Fri, 20 Apr 2012 12:59:30 +0000 (14:59 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 23 Apr 2012 17:20:19 +0000 (19:20 +0200)
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: I6b2d2530238a7e04b44859664a2962f2f466ee30
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
qmake/project.cpp

index c491e9b..9716237 100644 (file)
@@ -2085,7 +2085,7 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
                 dirs.append("");
             }
 
-            const QRegExp regex(r, Qt::CaseSensitive, QRegExp::Wildcard);
+            QRegExp regex(r, Qt::CaseSensitive, QRegExp::Wildcard);
             for(int d = 0; d < dirs.count(); d++) {
                 QString dir = dirs[d];
                 if (!dir.isEmpty() && !dir.endsWith(QLatin1Char('/')))