diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-03-25 15:43:13 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-03-27 09:23:03 +0000 |
commit | b6d0ed435d2d57359b6eafb2728c024eab0b1ece (patch) | |
tree | 33e4f7ba12d768bbc08f461a47a6bba2f9efb824 /src/qml/jsruntime/qv4generatorobject.cpp | |
parent | 1b43149decdf42e47405a9e43840b7382076cb0d (diff) |
Scope intermediate values when allocating objects
Otherwise the garbage collector might interfere and we might end up
with dangling pointers in random places.
Task-number: QTBUG-74190
Change-Id: I253c526ef930b8f0be14e96a42af8b66fda3b22d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4generatorobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4generatorobject.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4generatorobject.cpp b/src/qml/jsruntime/qv4generatorobject.cpp index 566db6fd4e..14caa6953f 100644 --- a/src/qml/jsruntime/qv4generatorobject.cpp +++ b/src/qml/jsruntime/qv4generatorobject.cpp @@ -139,7 +139,9 @@ void GeneratorPrototype::init(ExecutionEngine *engine, Object *ctor) Scope scope(engine); ScopedValue v(scope); - ScopedObject ctorProto(scope, engine->newObject(engine->newInternalClass(Object::staticVTable(), engine->functionPrototype()))); + Scoped<InternalClass> ic(scope, engine->newInternalClass( + Object::staticVTable(), engine->functionPrototype())); + ScopedObject ctorProto(scope, engine->newObject(ic->d())); ctor->defineReadonlyConfigurableProperty(engine->id_length(), Value::fromInt32(1)); ctor->defineReadonlyProperty(engine->id_prototype(), ctorProto); |