summaryrefslogtreecommitdiff
path: root/src/libs/qmljs/qmljsbundle.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2013-07-10 11:50:46 +0200
committerErik Verbruggen <erik.verbruggen@digia.com>2013-07-17 12:46:10 +0200
commit762099487cde386b206953cc84dafae13ab1fcc2 (patch)
tree8fa51fb501a04c0016458d17060d35ee7a8cb503 /src/libs/qmljs/qmljsbundle.cpp
parent7702ad52ce85e1f44f62b24e0414d81bebcabe88 (diff)
downloadqt-creator-762099487cde386b206953cc84dafae13ab1fcc2.tar.gz
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 <fawzi.mohamed@digia.com>
Diffstat (limited to 'src/libs/qmljs/qmljsbundle.cpp')
-rw-r--r--src/libs/qmljs/qmljsbundle.cpp4
1 files changed, 3 insertions, 1 deletions
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);