summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-15 11:19:50 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-15 16:53:45 +0000
commit7b2cbb3e9dae2080c76f8858daa3743f3e7aac1d (patch)
tree9c1fd20ceff322222a95a69e266b40e411fda1c5 /src/core
parent3a28b83b6f7dabff75483c38bbc786c2ff7af321 (diff)
Fix access of freed data
The string parts inside the lambda construction were already freed, so instead use a simpler construction where we are sure we are still holding the stringlist. Change-Id: I3559ab9d203b368e2d62efef73497ce7f9135cc5 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/browser_context_adapter.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index b9d439596..a6d3dfa4d 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -54,8 +54,6 @@
#include <QString>
#include <QStandardPaths>
-#include <numeric>
-
namespace {
inline QString buildLocationFromStandardPath(const QString &standardPath, const QString &name) {
QString location = standardPath;
@@ -405,11 +403,13 @@ void BrowserContextAdapter::permissionRequestReply(const QUrl &origin, Permissio
QString BrowserContextAdapter::httpAcceptLanguageWithoutQualities() const
{
const QStringList list = m_httpAcceptLanguage.split(QLatin1Char(','));
- return std::accumulate(list.constBegin(), list.constEnd(), QString(),
- [](const QString &r, const QString &e) -> QString {
- return (r.isEmpty() ? r : r + QString(QLatin1Char(',')))
- + e.split(QLatin1Char(';')).first();
- });
+ QString out;
+ Q_FOREACH (const QString& str, list) {
+ if (!out.isEmpty())
+ out.append(QLatin1Char(','));
+ out.append(str.split(QLatin1Char(';')).first());
+ }
+ return out;
}
QString BrowserContextAdapter::httpAcceptLanguage() const