From 5131bb9bed3af7a2ecfce27af3940ff11ed219c2 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 11 Aug 2017 13:24:43 +0200 Subject: [PATCH] qmake: fix excessive detaching of raw data ... in $$basename(), $$dirname(), and contains(). the latter case is marginal, as it only applies to mutuals which are regexes, which i don't remember ever seeing used. QRegExp saves a copy of the matched string, so it's necessary to alternate between two temporaries to avoid detaching. we already did that in most places. Change-Id: I97b8294585c17c76d1756f83971f42cb88353af0 Reviewed-by: Joerg Bornemann --- qmake/library/qmakebuiltins.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qmake/library/qmakebuiltins.cpp b/qmake/library/qmakebuiltins.cpp index a6d9df0fb9..211b3d3f02 100644 --- a/qmake/library/qmakebuiltins.cpp +++ b/qmake/library/qmakebuiltins.cpp @@ -585,8 +585,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand( if (regexp) { QRegExp sepRx(sep); for (const ProString &str : strings) { - const QString &rstr = str.toQString(m_tmp1).section(sepRx, beg, end); - ret << (rstr.isSharedWith(m_tmp1) ? str : ProString(rstr).setSource(str)); + const QString &rstr = str.toQString(m_tmp[m_toggle ^= 1]).section(sepRx, beg, end); + ret << (rstr.isSharedWith(m_tmp[m_toggle]) ? str : ProString(rstr).setSource(str)); } } else { for (const ProString &str : strings) { @@ -1471,7 +1471,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( for (int mut = 0; mut < mutuals.count(); mut++) { if (val == mutuals[mut].trimmed()) { return returnBool((!regx.isEmpty() - && regx.exactMatch(val.toQString(m_tmp2))) + && regx.exactMatch(val.toQString(m_tmp[m_toggle ^= 1]))) || val == qry); } }