diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-12-03 10:42:07 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-12-20 12:00:04 +0100 |
commit | db7b7d4161048ec481d80deaac5ff8cfa9487626 (patch) | |
tree | 752f9935485909f936c6adbcfd847cfa4763c85e /src/qml/jsruntime/qv4argumentsobject.cpp | |
parent | 42aba3076dc9b6c4f8f35dd79cbf2992f7373d4f (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/qv4argumentsobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4argumentsobject.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4argumentsobject.cpp b/src/qml/jsruntime/qv4argumentsobject.cpp index f7493353ff..d9e6caf5ab 100644 --- a/src/qml/jsruntime/qv4argumentsobject.cpp +++ b/src/qml/jsruntime/qv4argumentsobject.cpp @@ -109,7 +109,7 @@ bool ArgumentsObject::defineOwnProperty(ExecutionEngine *engine, uint index, con uint numAccessors = qMin((int)context()->function->formalParameterCount(), context()->realArgumentCount); if (pd && index < (uint)numAccessors) isMapped = arrayData()->attributes(index).isAccessor() && - pd->getter()->d() == context()->engine->argumentsAccessors[index].getter()->d(); + pd->getter() == context()->engine->argumentsAccessors[index].getter(); if (isMapped) { Q_ASSERT(arrayData()); @@ -127,10 +127,11 @@ bool ArgumentsObject::defineOwnProperty(ExecutionEngine *engine, uint index, con if (isMapped && attrs.isData()) { Q_ASSERT(arrayData()); + ScopedFunctionObject setter(scope, map.setter()); ScopedCallData callData(scope, 1); callData->thisObject = this->asReturnedValue(); callData->args[0] = desc.value; - map.setter()->call(callData); + setter->call(callData); if (attrs.isWritable()) { setArrayAttributes(index, mapAttrs); |