From d7134b8b68f0b3530269f7d087bdecfc8986be6b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Mon, 1 Jul 2013 08:20:15 +0200 Subject: Replace us of v4 identifiers for object id mapping in qml compiler The compiler is executed in a separate thread, at which point it doesn't work very well to access the identifiers data structures of the engine on the main thread, allocate new strings and potentially also trigger GC. This patch moves the data into an intermediate QVector and constructs the identifier hash on the receiving end in QQmlContextData::setIdPropertyData. Change-Id: I676cf633cf1c55ee2e8f818e6963368ad55913cd Reviewed-by: Lars Knoll --- src/qml/qml/qqmlcompiler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/qml/qml/qqmlcompiler.cpp') diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 386255a89b..ee0d37b6d8 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -3554,10 +3554,10 @@ int QQmlCompiler::genContextCache() if (compileState->ids.count() == 0) return -1; - QV4::IdentifierHash cache(QV8Engine::getV4(engine->handle())); - cache.reserve(compileState->ids.count()); - for (Object *o = compileState->ids.first(); o; o = compileState->ids.next(o)) - cache.add(o->id, o->idIndex); + QVector cache(compileState->ids.count()); + int i = 0; + for (Object *o = compileState->ids.first(); o; o = compileState->ids.next(o), ++i) + cache[i] = QQmlContextData::ObjectIdMapping(o->id, o->idIndex); output->contextCaches.append(cache); return output->contextCaches.count() - 1; -- cgit v1.2.3