From 96dc9a19ae11ca140d681f0e2605b5f4b953e581 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 30 Dec 2015 02:30:34 +0100 Subject: QUrlQuery: fix a very expensive always-true check In a non-const function, if (d), d being a QSharedDataPointer, will resolve to if(d.data()), which detaches and returns a pointer to an unshared copy of the data. Thus, the test if (d) is always true. Fix by explicit use of constData(), as in other QUrlQuery functions. Change-Id: Ib926abdcdb069d69e34c3202c4cf451b7fc6a329 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/io/qurlquery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp index 2b695a4f7b..b5c4b7fdd2 100644 --- a/src/corelib/io/qurlquery.cpp +++ b/src/corelib/io/qurlquery.cpp @@ -733,7 +733,7 @@ QStringList QUrlQuery::allQueryItemValues(const QString &key, QUrl::ComponentFor */ void QUrlQuery::removeQueryItem(const QString &key) { - if (d) { + if (d.constData()) { Map::iterator it = d->findKey(key); if (it != d->itemList.end()) d->itemList.erase(it); -- cgit v1.2.3