forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user