[new compiler] Fix JavaScript expressions in composite types

When creating a composite type, we instantiate a nested QQmlObjectCreator
on the QQmlCompiledData of the composite type. It may be that this is
the first time the type is instantiated and the QV4::CompiledData::CompilationUnit
isn't linked into the engine yet. Instead of doing that on the QQmlComponent
side, do it in the QQmlObjectCreator constructor (on demand), so that it
also works for nested builders.

Change-Id: I614bbae4ef6da5a5960cc64b40b092663e1bd810
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Simon Hausmann 2013-09-20 14:34:15 +02:00 committed by The Qt Project
parent 6213d26cc0
commit ba68143c1b
2 changed files with 4 additions and 4 deletions

View File

@ -896,10 +896,6 @@ QQmlComponentPrivate::beginCreate(QQmlContextData *context)
enginePriv->referenceScarceResources();
QObject *rv = 0;
if (enginePriv->useNewCompiler) {
QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
if (cc->compilationUnit && !cc->compilationUnit->engine)
cc->compilationUnit->linkToEngine(v4);
state.creator = new QmlObjectCreator(context, cc);
rv = state.creator->create(start);
if (!rv)

View File

@ -486,6 +486,10 @@ QmlObjectCreator::QmlObjectCreator(QQmlContextData *parentContext, QQmlCompiledD
, _vmeMetaObject(0)
, _qmlContext(0)
{
QV4::ExecutionEngine *v4 = QV8Engine::getV4(engine);
if (compiledData->compilationUnit && !compiledData->compilationUnit->engine)
compiledData->compilationUnit->linkToEngine(v4);
}
QObject *QmlObjectCreator::create(int subComponentIndex, QObject *parent)