diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-18 16:36:02 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-22 01:06:20 +0200 |
commit | df5edd28bc4258b89d9d5ffdddf837f339a17aad (patch) | |
tree | 2a5939d5e3c49928aadf43337832d3ef5a58df08 /src/qml/qml/qqmlcontextwrapper.cpp | |
parent | 700ba1bcb39e082049c96fafdfaccfe5d83cd77e (diff) |
convert Managed::put() API to be GC safe
Change-Id: I09198ce372fa545372db389fac26828d21ad5731
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlcontextwrapper.cpp')
-rw-r--r-- | src/qml/qml/qqmlcontextwrapper.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index 40b90037d8..e1c75f2f26 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -272,7 +272,7 @@ ReturnedValue QmlContextWrapper::get(Managed *m, const StringRef name, bool *has return Value::undefinedValue().asReturnedValue(); } -void QmlContextWrapper::put(Managed *m, String *name, const Value &value) +void QmlContextWrapper::put(Managed *m, const StringRef name, const ValueRef value) { ExecutionEngine *v4 = m->engine(); QV4::Scope scope(v4); @@ -293,10 +293,9 @@ void QmlContextWrapper::put(Managed *m, String *name, const Value &value) } PropertyAttributes attrs; - ScopedString n(scope, name); - Property *pd = wrapper->__getOwnProperty__(n, &attrs); + Property *pd = wrapper->__getOwnProperty__(name, &attrs); if (pd) { - wrapper->putValue(pd, attrs, value); + wrapper->putValue(pd, attrs, *value); return; } @@ -314,18 +313,18 @@ void QmlContextWrapper::put(Managed *m, String *name, const Value &value) while (context) { // Search context properties - if (context->propertyNames.count() && -1 != context->propertyNames.value(name)) + if (context->propertyNames.count() && -1 != context->propertyNames.value(name.getPointer())) return; // Search scope object if (scopeObject && - QV4::QObjectWrapper::setQmlProperty(v4->current, context, scopeObject, name, QV4::QObjectWrapper::CheckRevision, value)) + QV4::QObjectWrapper::setQmlProperty(v4->current, context, scopeObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, *value)) return; scopeObject = 0; // Search context object if (context->contextObject && - QV4::QObjectWrapper::setQmlProperty(v4->current, context, context->contextObject, name, QV4::QObjectWrapper::CheckRevision, value)) + QV4::QObjectWrapper::setQmlProperty(v4->current, context, context->contextObject, name.getPointer(), QV4::QObjectWrapper::CheckRevision, *value)) return; context = context->parent; |