diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:26:22 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:48:46 +0200 |
commit | 1a9759855639b9e2b3cdc0687d3381dcbf6c9815 (patch) | |
tree | b2da51f6eddddb83c2d97cdcfac24d38d2e67a4e /src/qml/qml/qqmlvme.cpp | |
parent | 8217ec1b888f3ff93f004801b018c5f85362c484 (diff) | |
parent | e1fc2793aef53b84a3f1e19b6d6bdf1141340074 (diff) |
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
src/imports/qtquick2/plugins.qmltypes
src/qml/debugger/qv8debugservice.cpp
src/qml/qml/qml.pri
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlcomponent.cpp
src/qml/qml/qqmlcontext.cpp
src/qml/qml/qqmldata_p.h
src/qml/qml/qqmlengine_p.h
src/qml/qml/qqmljavascriptexpression.cpp
src/qml/qml/qqmlxmlhttprequest.cpp
src/qml/qml/v4/qv4bindings.cpp
src/qml/qml/v4/qv4irbuilder.cpp
src/qml/qml/v4/qv4jsonobject_p.h
src/qml/qml/v8/qqmlbuiltinfunctions.cpp
src/qml/qml/v8/qv8bindings.cpp
src/qml/qml/v8/qv8contextwrapper.cpp
src/qml/qml/v8/qv8listwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper_p.h
src/qml/qml/v8/qv8sequencewrapper_p_p.h
src/qml/qml/v8/qv8typewrapper.cpp
src/qml/qml/v8/qv8valuetypewrapper.cpp
src/qml/types/qqmldelegatemodel.cpp
src/quick/items/context2d/qquickcanvasitem.cpp
src/quick/items/context2d/qquickcontext2d.cpp
sync.profile
tests/auto/qml/qjsengine/tst_qjsengine.cpp
tests/benchmarks/qml/animation/animation.pro
tools/qmlprofiler/qmlprofiler.pro
Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
Diffstat (limited to 'src/qml/qml/qqmlvme.cpp')
-rw-r--r-- | src/qml/qml/qqmlvme.cpp | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 309275777e..cde16e885d 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -47,6 +47,7 @@ #include <private/qmetaobjectbuilder_p.h> #include "qqmldata_p.h" #include "qqml.h" +#include "qqmlinfo.h" #include "qqmlcustomparser_p.h" #include "qqmlengine.h" #include "qqmlcontext.h" @@ -91,6 +92,8 @@ using namespace QQmlVMETypes; goto exceptionExit; \ } +bool QQmlVME::s_enableComponentComplete = true; + void QQmlVME::init(QQmlContextData *ctxt, QQmlCompiledData *comp, int start, QQmlContextData *creation) { @@ -132,12 +135,12 @@ bool QQmlVME::initDeferred(QObject *object) { QQmlData *data = QQmlData::get(object); - if (!data || !data->context || !data->compiledData) + if (!data || !data->deferredData) return false; - QQmlContextData *ctxt = data->context; - QQmlCompiledData *comp = data->compiledData; - int start = data->deferredIdx; + QQmlContextData *ctxt = data->deferredData->context; + QQmlCompiledData *comp = data->deferredData->compiledData; + int start = data->deferredData->deferredIdx; State initState; initState.flags = State::Deferred; @@ -949,10 +952,19 @@ QObject *QQmlVME::run(QList<QQmlError> *errors, if (instr.deferCount) { QObject *target = objects.top(); QQmlData *data = QQmlData::get(target, true); - data->compiledData = COMP; - data->compiledData->addref(); // Keep this data referenced until we're initialized - data->deferredIdx = INSTRUCTIONSTREAM - COMP->bytecode.constData(); - Q_ASSERT(data->deferredIdx != 0); + if (data->deferredData) { + //This rare case still won't always work right + qmlInfo(target) << "Setting deferred property across multiple components may not work"; + delete data->deferredData; + } + data->deferredData = new QQmlData::DeferredData; + //If we're in a CreateQML here, data->compiledData could be reset later + data->deferredData->compiledData = COMP; + data->deferredData->context = CTXT; + // Keep this data referenced until we're initialized + data->deferredData->compiledData->addref(); + data->deferredData->deferredIdx = INSTRUCTIONSTREAM - COMP->bytecode.constData(); + Q_ASSERT(data->deferredData->deferredIdx != 0); INSTRUCTIONSTREAM += instr.deferCount; } QML_END_INSTR(Defer) @@ -1243,7 +1255,7 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt) bindValues.deallocate(); } - if (!QQmlEnginePrivate::designerMode()) { // the qml designer does the component complete later + if (componentCompleteEnabled()) { // the qml designer does the component complete later QQmlTrace trace("VME Component Complete"); while (!parserStatus.isEmpty()) { QQmlParserStatus *status = parserStatus.pop(); @@ -1291,7 +1303,8 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt) Q_ASSERT(d); Q_ASSERT(d->context); a->add(&d->context->componentAttached); - emit a->completed(); + if (componentCompleteEnabled()) + emit a->completed(); if (watcher.hasRecursed() || interrupt.shouldInterrupt()) return 0; @@ -1307,6 +1320,21 @@ QQmlContextData *QQmlVME::complete(const Interrupt &interrupt) return rv; } +void QQmlVME::enableComponentComplete() +{ + s_enableComponentComplete = true; +} + +void QQmlVME::disableComponentComplete() +{ + s_enableComponentComplete = false; +} + +bool QQmlVME::componentCompleteEnabled() +{ + return s_enableComponentComplete; +} + void QQmlVME::blank(QFiniteStack<QQmlAbstractBinding *> &bs) { for (int ii = 0; ii < bs.count(); ++ii) { @@ -1368,7 +1396,7 @@ bool QQmlVMEGuard::isOK() const return false; for (int ii = 0; ii < m_contextCount; ++ii) - if (m_contexts[ii].isNull()) + if (m_contexts[ii].isNull() || !m_contexts[ii]->engine) return false; return true; |