aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4lookup.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2014-12-03 10:42:07 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-12-20 12:00:04 +0100
commitdb7b7d4161048ec481d80deaac5ff8cfa9487626 (patch)
tree752f9935485909f936c6adbcfd847cfa4763c85e /src/qml/jsruntime/qv4lookup.cpp
parent42aba3076dc9b6c4f8f35dd79cbf2992f7373d4f (diff)
Return a Heap object from the getter()/setter() methods of Property
We actually need to put the returned value into a ScopedFunctionObject before calling it, as the Property could get deleted during the call leading to a dangling pointer. With a GC that moves objects this will become even more important. Change-Id: I43bece6f80eb3501c1291065846e230a59ae8aed Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4lookup.cpp')
-rw-r--r--src/qml/jsruntime/qv4lookup.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4lookup.cpp b/src/qml/jsruntime/qv4lookup.cpp
index dead79a939..abb769b171 100644
--- a/src/qml/jsruntime/qv4lookup.cpp
+++ b/src/qml/jsruntime/qv4lookup.cpp
@@ -434,7 +434,7 @@ ReturnedValue Lookup::getterAccessor0(Lookup *l, ExecutionEngine *engine, const
Object *o = object->objectValue();
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
@@ -456,7 +456,7 @@ ReturnedValue Lookup::getterAccessor1(Lookup *l, ExecutionEngine *engine, const
if (l->classList[0] == o->internalClass &&
l->classList[1] == o->prototype->internalClass) {
Scope scope(o->internalClass->engine);
- FunctionObject *getter = o->prototype->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->prototype->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
@@ -481,7 +481,7 @@ ReturnedValue Lookup::getterAccessor2(Lookup *l, ExecutionEngine *engine, const
o = o->prototype;
if (l->classList[2] == o->internalClass) {
Scope scope(o->internalClass->engine);
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
@@ -525,7 +525,7 @@ ReturnedValue Lookup::primitiveGetterAccessor0(Lookup *l, ExecutionEngine *engin
Object *o = l->proto;
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
@@ -545,7 +545,7 @@ ReturnedValue Lookup::primitiveGetterAccessor1(Lookup *l, ExecutionEngine *engin
if (l->classList[0] == o->internalClass() &&
l->classList[1] == o->prototype()->internalClass) {
Scope scope(o->engine());
- FunctionObject *getter = o->prototype()->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->prototype()->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
@@ -648,7 +648,7 @@ ReturnedValue Lookup::globalGetterAccessor0(Lookup *l, ExecutionEngine *engine)
Object *o = engine->globalObject();
if (l->classList[0] == o->internalClass()) {
Scope scope(o->engine());
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
@@ -666,7 +666,7 @@ ReturnedValue Lookup::globalGetterAccessor1(Lookup *l, ExecutionEngine *engine)
if (l->classList[0] == o->internalClass() &&
l->classList[1] == o->prototype()->internalClass) {
Scope scope(o->engine());
- FunctionObject *getter = o->prototype()->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->prototype()->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();
@@ -687,7 +687,7 @@ ReturnedValue Lookup::globalGetterAccessor2(Lookup *l, ExecutionEngine *engine)
o = o->prototype;
if (l->classList[2] == o->internalClass) {
Scope scope(o->internalClass->engine);
- FunctionObject *getter = o->propertyAt(l->index)->getter();
+ ScopedFunctionObject getter(scope, o->propertyAt(l->index)->getter());
if (!getter)
return Encode::undefined();