From 762099487cde386b206953cc84dafae13ab1fcc2 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 10 Jul 2013 11:50:46 +0200 Subject: QML: add a memory pool to the Json* classes. The memory pool is not too efficient, but will keep objects from leaking. Change-Id: I68a55bc7a6ea56463652245abeea8954b693c1d7 Reviewed-by: Fawzi Mohamed --- src/libs/qmljs/qmljsbundle.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/libs/qmljs/qmljsbundle.cpp') diff --git a/src/libs/qmljs/qmljsbundle.cpp b/src/libs/qmljs/qmljsbundle.cpp index 9f755f04be..8b2ff587b4 100644 --- a/src/libs/qmljs/qmljsbundle.cpp +++ b/src/libs/qmljs/qmljsbundle.cpp @@ -250,6 +250,8 @@ QStringList QmlBundle::maybeReadTrie(Trie &trie, Utils::JsonObjectValue *config, bool QmlBundle::readFrom(QString path, QStringList *errors) { + Utils::JsonMemoryPool pool; + using namespace Utils; QFile f(path); if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) { @@ -257,7 +259,7 @@ bool QmlBundle::readFrom(QString path, QStringList *errors) (*errors) << QString::fromLatin1("Could not open file at %1 .").arg(path); return false; } - JsonObjectValue *config = JsonValue::create(QString::fromUtf8(f.readAll()))->toObject(); + JsonObjectValue *config = JsonValue::create(QString::fromUtf8(f.readAll()), &pool)->toObject(); if (config == 0) { if (errors) (*errors) << QString::fromLatin1("Could not parse json object in file at %1 .").arg(path); -- cgit v1.2.1