summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2013-11-12 16:26:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-16 17:43:45 +0100
commitbb0355ba3f4a5b23da14dc2d1a54d21926a92b0d (patch)
tree325376cd1f718c44607504742e1b92341333ee16 /Source
parentb12852d4eaadd227f9ced218f64175bd4eb6b9c0 (diff)
Fix crash when converting QObjectList
We were passing on a PassRefPtr to multiple lower calls, since any conversion from a PassRefPtr to a RefPtr will reset the PassRefPtr to null, it should not be used for multiple calls. Task-number: QTBUG-34278 Change-Id: I8d4bf28e25eb6e66baef38e0352c40a08f504538 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/bridge/qt/qt_runtime.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp
index d382462ac..e6a3e6b9f 100644
--- a/Source/WebCore/bridge/qt/qt_runtime.cpp
+++ b/Source/WebCore/bridge/qt/qt_runtime.cpp
@@ -805,10 +805,11 @@ JSValueRef convertQVariantToValue(JSContextRef context, PassRefPtr<RootObject> r
} else if (type == static_cast<QMetaType::Type>(qMetaTypeId<QObjectList>())) {
QObjectList ol = variant.value<QObjectList>();
JSObjectRef array = JSObjectMakeArray(context, 0, 0, exception);
+ RefPtr<RootObject> rootRef(root); // We need a real reference, since PassRefPtr may only be passed on to one call.
ExecState* exec = toJS(context);
APIEntryShim entryShim(exec);
for (int i = 0; i < ol.count(); ++i) {
- JSValueRef jsObject = toRef(exec, QtInstance::getQtInstance(ol.at(i), root, QtInstance::QtOwnership)->createRuntimeObject(exec));
+ JSValueRef jsObject = toRef(exec, QtInstance::getQtInstance(ol.at(i), rootRef, QtInstance::QtOwnership)->createRuntimeObject(exec));
JSObjectSetPropertyAtIndex(context, array, i, jsObject, /*ignored exception*/0);
}
return array;