aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4qobjectwrapper.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-30 13:48:05 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-02 16:07:33 +0200
commit430dfd326cb9d8dab8ebd11e83dd52e6d55c4229 (patch)
tree0d1dd82ddf8f027a591e93def6ce369237af725a /src/qml/jsruntime/qv4qobjectwrapper.cpp
parent3dc090fc1eb0a810d96ffc87e4662f7eb9ac8fd2 (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/qv4qobjectwrapper.cpp')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 53e915c1a4..90a1950395 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -646,13 +646,11 @@ PropertyAttributes QObjectWrapper::query(const Managed *m, StringRef name)
return QV4::Object::query(m, name);
}
-Property *QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, String **name, uint *index, PropertyAttributes *attributes)
+Property *QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, StringRef name, uint *index, PropertyAttributes *attributes)
{
- *name = 0;
+ name = (String *)0;
*index = UINT_MAX;
- QV4::Scope scope(m->engine());
-
QObjectWrapper *that = static_cast<QObjectWrapper*>(m);
if (!that->m_object)
@@ -661,22 +659,20 @@ Property *QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, String
const QMetaObject *mo = that->m_object->metaObject();
const int propertyCount = mo->propertyCount();
if (it->arrayIndex < propertyCount) {
- ScopedString n(scope, that->engine()->newString(QString::fromUtf8(mo->property(it->arrayIndex).name())));
- *name = n.getPointer();
+ name = that->engine()->newString(QString::fromUtf8(mo->property(it->arrayIndex).name()));
++it->arrayIndex;
if (attributes)
*attributes = QV4::Attr_Data;
- it->tmpDynamicProperty.value = that->get(n);
+ it->tmpDynamicProperty.value = that->get(name);
return &it->tmpDynamicProperty;
}
const int methodCount = mo->methodCount();
if (it->arrayIndex < propertyCount + methodCount) {
- ScopedString n(scope, that->engine()->newString(QString::fromUtf8(mo->method(it->arrayIndex - propertyCount).name())));
- *name = n.getPointer();
+ name = that->engine()->newString(QString::fromUtf8(mo->method(it->arrayIndex - propertyCount).name()));
++it->arrayIndex;
if (attributes)
*attributes = QV4::Attr_Data;
- it->tmpDynamicProperty.value = that->get(n);
+ it->tmpDynamicProperty.value = that->get(name);
return &it->tmpDynamicProperty;
}
return QV4::Object::advanceIterator(m, it, name, index, attributes);