diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-30 13:48:05 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-02 16:07:33 +0200 |
commit | 430dfd326cb9d8dab8ebd11e83dd52e6d55c4229 (patch) | |
tree | 0d1dd82ddf8f027a591e93def6ce369237af725a /src/qml/jsruntime/qv4objectproto.cpp | |
parent | 3dc090fc1eb0a810d96ffc87e4662f7eb9ac8fd2 (diff) |
Fix ObjectIterator API to be GC safe
Change-Id: I3a9c48d53d8dbadcb9b32c00fcef1f89447c4b8c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4objectproto.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4objectproto.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index 65fd2188ac..20a5c51692 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -222,14 +222,12 @@ ReturnedValue ObjectPrototype::method_defineProperties(SimpleCallContext *ctx) Scoped<Object> o(scope, ctx->argument(1), Scoped<Object>::Convert); ScopedValue val(scope); - ObjectIterator it(o.getPointer(), ObjectIterator::EnumerableOnly); + ObjectIterator it(scope, o, ObjectIterator::EnumerableOnly); + ScopedString name(scope); while (1) { uint index; - ScopedString name(scope); PropertyAttributes attrs; - String *tmp = 0; - Property *pd = it.next(&tmp, &index, &attrs); - name = tmp; + Property *pd = it.next(name, &index, &attrs); if (!pd) break; Property n; @@ -375,7 +373,7 @@ ReturnedValue ObjectPrototype::method_keys(SimpleCallContext *ctx) Scoped<ArrayObject> a(scope, ctx->engine->newArrayObject()); - ObjectIterator it(o.getPointer(), ObjectIterator::EnumerableOnly); + ObjectIterator it(scope, o, ObjectIterator::EnumerableOnly); ScopedValue name(scope); while (1) { name = it.nextPropertyNameAsString(); @@ -652,7 +650,7 @@ Returned<ArrayObject> *ObjectPrototype::getOwnPropertyNames(ExecutionEngine *v4, Scoped<ArrayObject> array(scope, v4->newArrayObject()); ScopedObject O(scope, o); if (O) { - ObjectIterator it(O.getPointer(), ObjectIterator::NoFlags); + ObjectIterator it(scope, O, ObjectIterator::NoFlags); ScopedValue name(scope); while (1) { name = it.nextPropertyNameAsString(); |