diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-17 22:33:48 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-22 01:06:20 +0200 |
commit | 2d781c4ca42f50643fa37200073a2fb2644b3806 (patch) | |
tree | 9554dbea266f6fbb7820db018e39624b6c0f1353 /src/qml/qml/v8/qqmlbuiltinfunctions.cpp | |
parent | 21198a676128a52e892557bc434035bcd1ddfaac (diff) |
Cleanup ExecutionEngine::newBuiltinFunction() usages
And change the return type to be GC safe
Change-Id: I6d7513962370fea4072a3d8c6b2c6f2d1705992e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/v8/qqmlbuiltinfunctions.cpp')
-rw-r--r-- | src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 40b5075ddd..bd10b7e719 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -92,6 +92,8 @@ QV4::QtObject::QtObject(ExecutionEngine *v4, QQmlEngine *qmlEngine) { vtbl = &static_vtbl; + Scope scope(v4); + // Set all the enums from the "Qt" namespace const QMetaObject *qtMetaObject = StaticQtMetaObject::get(); for (int ii = 0; ii < qtMetaObject->enumeratorCount(); ++ii) { @@ -141,25 +143,10 @@ QV4::QtObject::QtObject(ExecutionEngine *v4, QQmlEngine *qmlEngine) defineDefaultProperty(v4, QStringLiteral("createComponent"), method_createComponent); } - { - String *s = v4->newString(QStringLiteral("platform")); - Property *p = insertMember(s, Attr_Accessor); - FunctionObject* f = v4->newBuiltinFunction(v4->rootContext, s, method_get_platform); - p->setGetter(f); - } - { - String *s = v4->newString(QStringLiteral("application")); - Property *p = insertMember(s, Attr_Accessor); - FunctionObject* f = v4->newBuiltinFunction(v4->rootContext, s, method_get_application); - p->setGetter(f); - } + defineAccessorProperty(v4->newString(QStringLiteral("platform")), method_get_platform, 0); + defineAccessorProperty(v4->newString(QStringLiteral("application")), method_get_application, 0); #ifndef QT_NO_IM - { - String *s = v4->newString(QStringLiteral("inputMethod")); - Property *p = insertMember(s, Attr_Accessor); - FunctionObject* f = v4->newBuiltinFunction(v4->rootContext, s, method_get_inputMethod); - p->setGetter(f); - } + defineAccessorProperty(v4->newString(QStringLiteral("inputMethod")), method_get_inputMethod, 0); #endif } |