From c10bab71dc37ecffe67c6d9060f0dc37c2fcc7ea Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 22 May 2019 18:13:46 +0200 Subject: Tooling: Use QRegularExpression rather than QRegExp Task-number: QTBUG-72588 Change-Id: Ib79107ea01de2dee49dc783f1d88807d1852c3ba Reviewed-by: Simon Hausmann Reviewed-by: Samuel Gaist --- src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp') diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index 8293e88038..834068240c 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -357,10 +357,7 @@ void QQmlDebugServerImpl::parseArguments() if (ok) { const QString nextArgument = argsNext->toString(); - // Don't use QStringLiteral here. QRegExp has a global cache and will save an implicitly - // shared copy of the passed string. That copy isn't properly detached when the library - // is unloaded if the original string lives in the library's .rodata - if (nextArgument.contains(QRegExp(QLatin1String("^\\s*\\d+\\s*$")))) { + if (nextArgument.contains(QRegularExpression(QLatin1String("^\\s*\\d+\\s*$")))) { portTo = nextArgument.toInt(&ok); ++argsIt; } -- cgit v1.2.3 From b6adafe256c87f611b8e6790dbf37c80aa98e353 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 23 May 2019 10:42:57 +0200 Subject: Tooling: Guard use of QRegularExpression The Qt we are using might be compiled without regular expressions. The epxression in qqmldebugserver.cpp is actually not needed as QString::toInt() can do this check for us. The ones in globalinspector.cpp are only for reformatting the name in a nicer way for the selection highlight. We can skip those in case there are no regular expressions. Change-Id: I71e3f0314d8a68a41c3da2568207e311c6b41d1b Reviewed-by: Simon Hausmann --- src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp') diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index 834068240c..2d5282b48c 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -355,11 +355,12 @@ void QQmlDebugServerImpl::parseArguments() if (argsNext == argsItEnd) break; if (ok) { - const QString nextArgument = argsNext->toString(); - - if (nextArgument.contains(QRegularExpression(QLatin1String("^\\s*\\d+\\s*$")))) { - portTo = nextArgument.toInt(&ok); + portTo = argsNext->toString().toInt(&ok); + if (ok) { ++argsIt; + } else { + portTo = portFrom; + ok = true; } } } else if (strArgument.startsWith(QLatin1String("host:"))) { -- cgit v1.2.3