diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-18 09:58:57 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-18 09:58:57 +0100 |
commit | ba9ca0e3d64c46fc63cdbc62f3e4a96e36a842f8 (patch) | |
tree | f9631624c841281302a2a546fbcc06a2375f410e /src/qml | |
parent | a65b8785621ebf58f34eb0c1759376fc0a1117c7 (diff) | |
parent | 464bd2bf975797241213191a374e70431c5c3763 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/qml/jsruntime/qv4functionobject.cpp
src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h
Change-Id: Id164f6c3b45501aa466908659ec4e3b957323753
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/compiler/qv4isel_p.cpp | 3 | ||||
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 3 | ||||
-rw-r--r-- | src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc | 14 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 19 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression.cpp | 113 | ||||
-rw-r--r-- | src/qml/qml/qqmljavascriptexpression_p.h | 5 |
6 files changed, 90 insertions, 67 deletions
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp index b86837e167..644e06b59a 100644 --- a/src/qml/compiler/qv4isel_p.cpp +++ b/src/qml/compiler/qv4isel_p.cpp @@ -53,7 +53,8 @@ #include <cassert> namespace { -QTextStream qout(stderr, QIODevice::WriteOnly); +Q_GLOBAL_STATIC_WITH_ARGS(QTextStream, qout, (stderr, QIODevice::WriteOnly)); +#define qout *qout() } // anonymous namespace using namespace QQmlJS; diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 52c546039c..5f79146127 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -77,7 +77,8 @@ using namespace V4IR; namespace { -QTextStream qout(stdout, QIODevice::WriteOnly); +Q_GLOBAL_STATIC_WITH_ARGS(QTextStream, qout, (stderr, QIODevice::WriteOnly)); +#define qout *qout() void showMeTheCode(Function *function) { diff --git a/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc b/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc index c89d4a3c0d..88c866baf3 100644 --- a/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc +++ b/src/qml/doc/src/qmllanguageref/modules/qmldir.qdoc @@ -27,7 +27,7 @@ /*! \page qtqml-modules-qmldir.html \title Module Definition qmldir Files -\brief How to write a qmldir file which defines a QML module +\brief Defines a QML module There are two distinct types of \c qmldir files: \list @@ -177,6 +177,18 @@ plugin <Name> [<Path>] \code plugin MyPluginLibrary \endcode + \row + \li C++ Plugin Class + \li + \code + classname <C++ plugin class> + \endcode + \li Provides the class name of the C++ plugin used by the module. + + This information is required for all the QML modules that depend + on a C++ plugin for additional functionality. Qt Quick applications + built with static linking cannot resolve the module imports without + this information. \row \li Type Information Description File Declaration diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 58e0277395..fb87822a5a 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -447,11 +447,12 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData) callData->thisObject = obj.asReturnedValue(); ExecutionContext *ctx = context->newCallContext(f.getPointer(), callData); + ExecutionContextSaver ctxSaver(context); + ScopedValue result(scope, Q_V4_PROFILE(v4, ctx, f->function)); + if (f->function->compiledFunction->hasQmlDependencies()) QmlContextWrapper::registerQmlDependencies(v4, f->function->compiledFunction); - ExecutionContextSaver ctxSaver(context); - ScopedValue result(scope, Q_V4_PROFILE(v4, ctx, f->function)); if (result->isObject()) return result.asReturnedValue(); return obj.asReturnedValue(); @@ -470,11 +471,13 @@ ReturnedValue ScriptFunction::call(Managed *that, CallData *callData) CallContext *ctx = context->newCallContext(f, callData); + ExecutionContextSaver ctxSaver(context); + ScopedValue result(scope, Q_V4_PROFILE(v4, ctx, f->function)); + if (f->function->compiledFunction->hasQmlDependencies()) QmlContextWrapper::registerQmlDependencies(ctx->engine, f->function->compiledFunction); - ExecutionContextSaver ctxSaver(context); - return Q_V4_PROFILE(v4, ctx, f->function); + return result.asReturnedValue(); } DEFINE_OBJECT_VTABLE(SimpleScriptFunction); @@ -542,11 +545,11 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData) } Q_ASSERT(v4->currentContext() == &ctx); + Scoped<Object> result(scope, Q_V4_PROFILE(v4, &ctx, f->function)); + if (f->function->compiledFunction->hasQmlDependencies()) QmlContextWrapper::registerQmlDependencies(v4, f->function->compiledFunction); - Scoped<Object> result(scope, Q_V4_PROFILE(v4, &ctx, f->function)); - if (!result) return callData->thisObject.asReturnedValue(); return result.asReturnedValue(); @@ -579,10 +582,12 @@ ReturnedValue SimpleScriptFunction::call(Managed *that, CallData *callData) } Q_ASSERT(v4->currentContext() == &ctx); + ScopedValue result(scope, Q_V4_PROFILE(v4, &ctx, f->function)); + if (f->function->compiledFunction->hasQmlDependencies()) QmlContextWrapper::registerQmlDependencies(v4, f->function->compiledFunction); - return Q_V4_PROFILE(v4, &ctx, f->function); + return result.asReturnedValue(); } diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index b7673bdb37..b233b6e98c 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -138,8 +138,12 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context, QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context->engine); + // All code that follows must check with watcher before it accesses data members + // incase we have been deleted. + DeleteWatcher watcher(this); + Q_ASSERT(notifyOnValueChanged() || activeGuards.isEmpty()); - GuardCapture capture(context->engine, this); + GuardCapture capture(context->engine, this, &watcher); QQmlEnginePrivate::PropertyCapture *lastPropertyCapture = ep->propertyCapture; ep->propertyCapture = notifyOnValueChanged()?&capture:0; @@ -148,10 +152,6 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context, if (notifyOnValueChanged()) capture.guards.copyAndClearPrepend(activeGuards); - // All code that follows must check with watcher before it accesses data members - // incase we have been deleted. - DeleteWatcher watcher(this); - QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); QV4::Scope scope(v4); QV4::ScopedValue result(scope, QV4::Primitive::undefinedValue()); @@ -196,72 +196,75 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context, void QQmlJavaScriptExpression::GuardCapture::captureProperty(QQmlNotifier *n) { - if (expression) { + if (watcher->wasDeleted()) + return; + + Q_ASSERT(expression); + // Try and find a matching guard + while (!guards.isEmpty() && !guards.first()->isConnected(n)) + guards.takeFirst()->Delete(); + + Guard *g = 0; + if (!guards.isEmpty()) { + g = guards.takeFirst(); + g->cancelNotify(); + Q_ASSERT(g->isConnected(n)); + } else { + g = Guard::New(expression, engine); + g->connect(n); + } + + expression->activeGuards.prepend(g); +} + +/*! \internal + \reimp + + \a n is in the signal index range (see QObjectPrivate::signalIndex()). +*/ +void QQmlJavaScriptExpression::GuardCapture::captureProperty(QObject *o, int c, int n) +{ + if (watcher->wasDeleted()) + return; + + Q_ASSERT(expression); + if (n == -1) { + if (!errorString) { + errorString = new QStringList; + QString preamble = QLatin1String("QQmlExpression: Expression ") + + expression->m_vtable->expressionIdentifier(expression) + + QLatin1String(" depends on non-NOTIFYable properties:"); + errorString->append(preamble); + } + + const QMetaObject *metaObj = o->metaObject(); + QMetaProperty metaProp = metaObj->property(c); + + QString error = QLatin1String(" ") + + QString::fromUtf8(metaObj->className()) + + QLatin1String("::") + + QString::fromUtf8(metaProp.name()); + errorString->append(error); + } else { // Try and find a matching guard - while (!guards.isEmpty() && !guards.first()->isConnected(n)) + while (!guards.isEmpty() && !guards.first()->isConnected(o, n)) guards.takeFirst()->Delete(); Guard *g = 0; if (!guards.isEmpty()) { g = guards.takeFirst(); g->cancelNotify(); - Q_ASSERT(g->isConnected(n)); + Q_ASSERT(g->isConnected(o, n)); } else { g = Guard::New(expression, engine); - g->connect(n); + g->connect(o, n, engine); } expression->activeGuards.prepend(g); } } -/*! \internal - \reimp - - \a n is in the signal index range (see QObjectPrivate::signalIndex()). -*/ -void QQmlJavaScriptExpression::GuardCapture::captureProperty(QObject *o, int c, int n) -{ - if (expression) { - if (n == -1) { - if (!errorString) { - errorString = new QStringList; - QString preamble = QLatin1String("QQmlExpression: Expression ") + - expression->m_vtable->expressionIdentifier(expression) + - QLatin1String(" depends on non-NOTIFYable properties:"); - errorString->append(preamble); - } - - const QMetaObject *metaObj = o->metaObject(); - QMetaProperty metaProp = metaObj->property(c); - - QString error = QLatin1String(" ") + - QString::fromUtf8(metaObj->className()) + - QLatin1String("::") + - QString::fromUtf8(metaProp.name()); - errorString->append(error); - } else { - - // Try and find a matching guard - while (!guards.isEmpty() && !guards.first()->isConnected(o, n)) - guards.takeFirst()->Delete(); - - Guard *g = 0; - if (!guards.isEmpty()) { - g = guards.takeFirst(); - g->cancelNotify(); - Q_ASSERT(g->isConnected(o, n)); - } else { - g = Guard::New(expression, engine); - g->connect(o, n, engine); - } - - expression->activeGuards.prepend(g); - } - } -} - void QQmlJavaScriptExpression::clearError() { if (m_vtable.hasValue()) { diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h index 7d65f1c9cc..d0f10e498d 100644 --- a/src/qml/qml/qqmljavascriptexpression_p.h +++ b/src/qml/qml/qqmljavascriptexpression_p.h @@ -161,8 +161,8 @@ private: friend void QQmlJavaScriptExpressionGuard_callback(QQmlNotifierEndpoint *, void **); struct GuardCapture : public QQmlEnginePrivate::PropertyCapture { - GuardCapture(QQmlEngine *engine, QQmlJavaScriptExpression *e) - : engine(engine), expression(e), errorString(0) { } + GuardCapture(QQmlEngine *engine, QQmlJavaScriptExpression *e, DeleteWatcher *w) + : engine(engine), expression(e), watcher(w), errorString(0) { } ~GuardCapture() { Q_ASSERT(guards.isEmpty()); @@ -174,6 +174,7 @@ private: QQmlEngine *engine; QQmlJavaScriptExpression *expression; + DeleteWatcher *watcher; QFieldList<Guard, &Guard::next> guards; QStringList *errorString; }; |