Remove v8::Persistent usage from qquickloader
authorLars Knoll <lars.knoll@digia.com>
Wed, 8 May 2013 12:02:11 +0000 (14:02 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Wed, 8 May 2013 13:30:56 +0000 (15:30 +0200)
Change-Id: I0a7ffdc3ed159ec8f506cadc73ba8ae77c003a41
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
src/quick/items/qquickloader.cpp
src/quick/items/qquickloader_p_p.h

index e638346..8836df5 100644 (file)
@@ -579,8 +579,8 @@ void QQuickLoader::setSource(QQmlV8Function *args)
     QUrl sourceUrl = d->resolveSourceUrl(args);
     if (!ipv.IsEmpty()) {
         d->disposeInitialPropertyValues();
-        d->initialPropertyValues = qPersistentNew(ipv);
-        d->qmlGlobalForIpv = qPersistentNew(args->qmlGlobal());
+        d->initialPropertyValues = ipv->v4Value();
+        d->qmlGlobalForIpv = args->qmlGlobal()->v4Value();
     }
 
     setSource(sourceUrl, false); // already cleared and set ipv above.
@@ -588,10 +588,6 @@ void QQuickLoader::setSource(QQmlV8Function *args)
 
 void QQuickLoaderPrivate::disposeInitialPropertyValues()
 {
-    if (!initialPropertyValues.IsEmpty())
-        qPersistentDispose(initialPropertyValues);
-    if (!qmlGlobalForIpv.IsEmpty())
-        qPersistentDispose(qmlGlobalForIpv);
 }
 
 void QQuickLoaderPrivate::load()
@@ -645,12 +641,12 @@ void QQuickLoaderPrivate::setInitialState(QObject *obj)
         itemContext = 0;
     }
 
-    if (initialPropertyValues.IsEmpty())
+    if (initialPropertyValues.isEmpty())
         return;
 
     QQmlComponentPrivate *d = QQmlComponentPrivate::get(component);
     Q_ASSERT(d && d->engine);
-    d->initializeObjectWithInitialProperties(qmlGlobalForIpv, initialPropertyValues, obj);
+    d->initializeObjectWithInitialProperties(qmlGlobalForIpv.value(), initialPropertyValues.value(), obj);
 }
 
 void QQuickLoaderIncubator::statusChanged(Status status)
index b7d2d31..bc30d4f 100644 (file)
@@ -60,6 +60,8 @@
 
 #include <private/qv8_p.h>
 
+#include <private/qv4value_p.h>
+
 QT_BEGIN_NAMESPACE
 
 
@@ -108,8 +110,8 @@ public:
     QQmlComponent *component;
     QQmlContext *itemContext;
     QQuickLoaderIncubator *incubator;
-    v8::Persistent<v8::Object> initialPropertyValues;
-    v8::Persistent<v8::Object> qmlGlobalForIpv;
+    QV4::PersistentValue initialPropertyValues;
+    QV4::PersistentValue qmlGlobalForIpv;
     bool updatingSize: 1;
     bool active : 1;
     bool loadingFromSource : 1;