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/jsruntime/qv4qobjectwrapper.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/jsruntime/qv4qobjectwrapper.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4qobjectwrapper.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index c8488924a9..226de86a38 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -332,8 +332,8 @@ ReturnedValue QObjectWrapper::getQmlProperty(ExecutionContext *ctx, QQmlContextD QV4::ScopedString connect(scope, ctx->engine->newIdentifier(QStringLiteral("connect"))); QV4::ScopedString disconnect(scope, ctx->engine->newIdentifier(QStringLiteral("disconnect"))); - handler->put(connect.getPointer(), QV4::Value::fromReturnedValue(ctx->engine->functionClass->prototype->get(connect))); - handler->put(disconnect.getPointer(), QV4::Value::fromReturnedValue(ctx->engine->functionClass->prototype->get(disconnect))); + handler->put(connect, QV4::ScopedValue(scope, ctx->engine->functionClass->prototype->get(connect))); + handler->put(disconnect, QV4::ScopedValue(scope, ctx->engine->functionClass->prototype->get(disconnect))); return QV4::Value::fromObject(handler).asReturnedValue(); } else { @@ -605,7 +605,7 @@ QV4::ReturnedValue QObjectWrapper::get(Managed *m, const StringRef name, bool *h return that->getQmlProperty(v4->current, qmlContext, name.getPointer(), IgnoreRevision, hasProperty, /*includeImports*/ true); } -void QObjectWrapper::put(Managed *m, String *name, const Value &value) +void QObjectWrapper::put(Managed *m, const StringRef name, const ValueRef value) { QObjectWrapper *that = static_cast<QObjectWrapper*>(m); ExecutionEngine *v4 = m->engine(); @@ -614,7 +614,7 @@ void QObjectWrapper::put(Managed *m, String *name, const Value &value) return; QQmlContextData *qmlContext = QV4::QmlContextWrapper::callingContext(v4); - if (!setQmlProperty(v4->current, qmlContext, that->m_object, name, QV4::QObjectWrapper::IgnoreRevision, value)) { + if (!setQmlProperty(v4->current, qmlContext, that->m_object, name.getPointer(), QV4::QObjectWrapper::IgnoreRevision, *value)) { QString error = QLatin1String("Cannot assign to non-existent property \"") + name->toQString() + QLatin1Char('\"'); v4->current->throwError(error); |