diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-06-28 13:28:09 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-06-28 13:28:10 +0200 |
commit | 63398defdbec12979b61120f690e984af0496c37 (patch) | |
tree | ab7a29ea0040d46c47004fed3c211a831bc48e9c /src/qml | |
parent | cff8d9f1d2d309cd9417bb93386a1443ed1892c3 (diff) | |
parent | 692b2da77427259a3589cf8a1311075863f2f5ec (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I59343fe228ca6b823b61577e5a0907e7381899c2
Diffstat (limited to 'src/qml')
-rw-r--r-- | src/qml/jsruntime/qv4qmlcontext.cpp | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 29 | ||||
-rw-r--r-- | src/qml/qml/qqmlprivate.h | 1 |
3 files changed, 37 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index 6aa0130188..969d44ecf6 100644 --- a/src/qml/jsruntime/qv4qmlcontext.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -539,7 +539,6 @@ ReturnedValue QQmlContextWrapper::lookupIdObject(Lookup *l, ExecutionEngine *eng ReturnedValue QQmlContextWrapper::lookupScopeObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base) { - Q_UNUSED(base) Scope scope(engine); Scoped<QmlContext> qmlContext(scope, engine->qmlContext()); if (!qmlContext) @@ -560,12 +559,15 @@ ReturnedValue QQmlContextWrapper::lookupScopeObjectProperty(Lookup *l, Execution }; ScopedValue obj(scope, QV4::QObjectWrapper::wrap(engine, scopeObject)); + + if (base) + *base = obj; + return QObjectWrapper::lookupGetterImpl(l, engine, obj, /*useOriginalProperty*/ true, revertLookup); } ReturnedValue QQmlContextWrapper::lookupContextObjectProperty(Lookup *l, ExecutionEngine *engine, Value *base) { - Q_UNUSED(base) Scope scope(engine); Scoped<QmlContext> qmlContext(scope, engine->qmlContext()); if (!qmlContext) @@ -590,6 +592,10 @@ ReturnedValue QQmlContextWrapper::lookupContextObjectProperty(Lookup *l, Executi }; ScopedValue obj(scope, QV4::QObjectWrapper::wrap(engine, contextObject)); + + if (base) + *base = obj; + return QObjectWrapper::lookupGetterImpl(l, engine, obj, /*useOriginalProperty*/ true, revertLookup); } diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 29b19b433f..0f8a850584 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -1641,7 +1641,14 @@ void qmlClearTypeRegistrations() // Declared in qqml.h #endif } -static int registerAutoParentFunction(QQmlPrivate::RegisterAutoParent &autoparent) +static void unregisterAutoParentFunction(const QQmlPrivate::AutoParentFunction &function) +{ + QMutexLocker lock(metaTypeDataLock()); + QQmlMetaTypeData *data = metaTypeData(); + data->parentFunctions.removeOne(function); +} + +static int registerAutoParentFunction(const QQmlPrivate::RegisterAutoParent &autoparent) { QMutexLocker lock(metaTypeDataLock()); QQmlMetaTypeData *data = metaTypeData(); @@ -1950,6 +1957,26 @@ int QQmlPrivate::qmlregister(RegistrationType type, void *data) return dtype.index(); } +void QQmlPrivate::qmlunregister(RegistrationType type, quintptr data) +{ + switch (type) { + case AutoParentRegistration: + unregisterAutoParentFunction(reinterpret_cast<AutoParentFunction>(data)); + break; + case QmlUnitCacheHookRegistration: + QQmlMetaType::removeCachedUnitLookupFunction( + reinterpret_cast<QmlUnitCacheLookupFunction>(data)); + break; + case TypeRegistration: + case InterfaceRegistration: + case SingletonRegistration: + case CompositeRegistration: + case CompositeSingletonRegistration: + qmlUnregisterType(data); + break; + } +} + //From qqml.h bool qmlProtectModule(const char *uri, int majVersion) { diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h index ae84803648..8a45de9f76 100644 --- a/src/qml/qml/qqmlprivate.h +++ b/src/qml/qml/qqmlprivate.h @@ -318,6 +318,7 @@ namespace QQmlPrivate }; int Q_QML_EXPORT qmlregister(RegistrationType, void *); + void Q_QML_EXPORT qmlunregister(RegistrationType, quintptr); } QT_END_NAMESPACE |