aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/v8/qv8engine.cpp
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2011-09-26 14:25:36 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-30 10:37:05 +0200
commit20fb62f6040ad8415828092a2b09bd374433505f (patch)
treedab84177a83c9e8c9e2d95c8025fd4f7aed2116e /src/declarative/qml/v8/qv8engine.cpp
parent54c1fa834aae16fc98fe2f9a3d2a93adc93254df (diff)
Modify JS Object to QVariant conversion
Previously, JS Objects would be converted to a QVariantMap where each value in the map was a QVariant from toVariant(propertyValue). Unfortunately, this would result in a crash if the object had a reference to another object which had a reference to the original object, due to the circular reference. This commit changes the conversion code to use QV8Engine::variantMapFromJS() instead, which avoids cyclic references. Task-number: QTBUG-21626 Change-Id: I129048c8704ae0d1095a02d0ce4c0fe5850b1b20 Reviewed-on: http://codereview.qt-project.org/5490 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/declarative/qml/v8/qv8engine.cpp')
-rw-r--r--src/declarative/qml/v8/qv8engine.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/declarative/qml/v8/qv8engine.cpp b/src/declarative/qml/v8/qv8engine.cpp
index 21084802e0..33c87b7196 100644
--- a/src/declarative/qml/v8/qv8engine.cpp
+++ b/src/declarative/qml/v8/qv8engine.cpp
@@ -460,13 +460,7 @@ QVariant QV8Engine::toBasicVariant(v8::Handle<v8::Value> value)
int length = properties->Length();
if (length == 0)
return QVariant();
-
- QVariantMap map;
- for (int ii = 0; ii < length; ++ii) {
- v8::Handle<v8::Value> property = properties->Get(ii);
- map.insert(toString(property), toVariant(object->Get(property), -1));
- }
- return map;
+ return variantMapFromJS(object);
}
return QVariant();