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/qqmlcontext.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/qml/qml/qqmlcontext.cpp') diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp index 55cfbc0654..7731935b75 100644 --- a/src/qml/qml/qqmlcontext.cpp +++ b/src/qml/qml/qqmlcontext.cpp @@ -770,10 +770,13 @@ void QQmlContextData::setIdProperty(int idx, QObject *obj) idValues[idx].context = this; } -void QQmlContextData::setIdPropertyData(const QV4::IdentifierHash &data) +void QQmlContextData::setIdPropertyData(const QVector &data) { Q_ASSERT(propertyNames.isEmpty()); - propertyNames = data; + propertyNames = QV4::IdentifierHash(QV8Engine::getV4(engine->handle())); + for (QVector::ConstIterator it = data.begin(), end = data.end(); + it != end; ++it) + propertyNames.add(it->name, it->id); idValueCount = data.count(); idValues = new ContextGuard[idValueCount]; -- cgit v1.2.3