aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4object.cpp9
-rw-r--r--src/qml/jsruntime/qv4object_p.h8
2 files changed, 9 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 7dd0a247d6..02524b7da6 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -93,7 +93,7 @@ void Heap::Object::setUsedAsProto()
internalClass.set(internalClass->engine, internalClass->asProtoClass());
}
-ReturnedValue Object::getValueAccessor(const Value &thisObject, const Value &v, PropertyAttributes attrs)
+ReturnedValue Object::getValueAccessor(const Value *thisObject, const Value &v, PropertyAttributes attrs)
{
if (!attrs.isAccessor())
return v.asReturnedValue();
@@ -103,7 +103,8 @@ ReturnedValue Object::getValueAccessor(const Value &thisObject, const Value &v,
Scope scope(f->engine());
JSCallData jsCallData(scope);
- *jsCallData->thisObject = thisObject;
+ if (thisObject)
+ *jsCallData->thisObject = *thisObject;
return f->call(jsCallData);
}
@@ -415,7 +416,7 @@ ReturnedValue Object::internalGet(PropertyKey id, const Value *receiver, bool *h
if (o->arrayData && o->arrayData->getProperty(index, pd, &attrs)) {
if (hasProperty)
*hasProperty = true;
- return Object::getValue(*receiver, pd->value, attrs);
+ return Object::getValue(receiver, pd->value, attrs);
}
if (o->internalClass->vtable->type == Type_StringObject) {
ScopedString str(scope, static_cast<Heap::StringObject *>(o)->getIndex(index));
@@ -438,7 +439,7 @@ ReturnedValue Object::internalGet(PropertyKey id, const Value *receiver, bool *h
if (idx.isValid()) {
if (hasProperty)
*hasProperty = true;
- return Object::getValue(*receiver, *o->propertyData(idx.index), idx.attrs);
+ return Object::getValue(receiver, *o->propertyData(idx.index), idx.attrs);
}
o = o->prototype();
if (!o || o->internalClass->vtable->get != Object::virtualGet)
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index c3f1cb2c35..bee4aadafe 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -185,22 +185,22 @@ struct Q_QML_EXPORT Object: Managed {
//
// helpers
//
- static ReturnedValue getValue(const Value &thisObject, const Value &v, PropertyAttributes attrs) {
+ static ReturnedValue getValue(const Value *thisObject, const Value &v, PropertyAttributes attrs) {
if (attrs.isData())
return v.asReturnedValue();
return getValueAccessor(thisObject, v, attrs);
}
ReturnedValue getValue(const Value &v, PropertyAttributes attrs) const {
- return getValue(*this, v, attrs);
+ return getValue(this, v, attrs);
}
ReturnedValue getValueByIndex(uint propertyIndex) const {
PropertyAttributes attrs = internalClass()->propertyData.at(propertyIndex);
const Value *v = propertyData(propertyIndex);
if (!attrs.isAccessor())
return v->asReturnedValue();
- return getValueAccessor(*this, *v, attrs);
+ return getValueAccessor(this, *v, attrs);
}
- static ReturnedValue getValueAccessor(const Value &thisObject, const Value &v, PropertyAttributes attrs);
+ static ReturnedValue getValueAccessor(const Value *thisObject, const Value &v, PropertyAttributes attrs);
bool putValue(uint memberIndex, PropertyAttributes attrs, const Value &value);