diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-12-30 02:30:34 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-12-30 12:05:59 +0000 |
commit | 96dc9a19ae11ca140d681f0e2605b5f4b953e581 (patch) | |
tree | f09894eb760b457d66d3b5bb891570114eb9b9dc /src/corelib/io | |
parent | 5c8186301996780b90e1b7b37b6142e885f3c9b0 (diff) |
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) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qurlquery.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
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); |