aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-13 09:01:29 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-13 22:42:04 +0100
commit39f1e0d66dc434e764731fbfed29c8fd98d217aa (patch)
treed9855dbedd752c23395ccb6d4d3dc8fc3bece254 /src
parenta38f9ec6c96559efa56e8f7346f74f5990810c3a (diff)
Make sure we always have an engine when assigning to a Persistent
This prepares things for a rewrite of the internals of Persistent. Change-Id: Ib93ec5911984d1bfce87ffdc3f86bc75f6ecafe9 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/jsapi/qjsvalueiterator.cpp6
-rw-r--r--src/qml/jsruntime/qv4debugging.cpp13
-rw-r--r--src/qml/jsruntime/qv4include.cpp6
-rw-r--r--src/qml/jsruntime/qv4persistent.cpp108
-rw-r--r--src/qml/jsruntime/qv4persistent_p.h29
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp8
-rw-r--r--src/qml/jsruntime/qv4scopedvalue_p.h5
-rw-r--r--src/qml/jsruntime/qv4script.cpp6
-rw-r--r--src/qml/jsruntime/qv4script_p.h2
-rw-r--r--src/qml/qml/qqmlbinding.cpp16
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp17
-rw-r--r--src/qml/qml/qqmlboundsignal_p.h2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp2
-rw-r--r--src/qml/qml/qqmlexpression.cpp8
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp4
-rw-r--r--src/qml/qml/qqmllocale.cpp2
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp2
-rw-r--r--src/qml/qml/qqmltypeloader.cpp6
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp6
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp16
-rw-r--r--src/qml/qml/v8/qv8engine.cpp2
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp4
-rw-r--r--src/qml/types/qquickworkerscript.cpp6
-rw-r--r--src/qml/util/qqmladaptormodel.cpp4
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp2
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp14
-rw-r--r--src/quick/items/qquickloader.cpp6
-rw-r--r--src/quick/items/qquickview.cpp2
28 files changed, 157 insertions, 147 deletions
diff --git a/src/qml/jsapi/qjsvalueiterator.cpp b/src/qml/jsapi/qjsvalueiterator.cpp
index 002a84ee08..c74a5d2d76 100644
--- a/src/qml/jsapi/qjsvalueiterator.cpp
+++ b/src/qml/jsapi/qjsvalueiterator.cpp
@@ -52,7 +52,7 @@ QJSValueIteratorPrivate::QJSValueIteratorPrivate(const QJSValue &v)
QV4::Scope scope(e);
QV4::ScopedObject o(scope, jsp->value);
- iterator = e->newForEachIteratorObject(o)->asReturnedValue();
+ iterator.set(e, e->newForEachIteratorObject(o));
currentName = (QV4::String *)0;
nextName = (QV4::String *)0;
@@ -216,14 +216,14 @@ QJSValueIterator& QJSValueIterator::operator=(QJSValue& object)
d_ptr->nextName = (QV4::String *)0;
QV4::ExecutionEngine *v4 = d_ptr->iterator.engine();
if (!v4) {
- d_ptr->iterator = QV4::Encode::undefined();
+ d_ptr->iterator.set(v4, QV4::Encode::undefined());
return *this;
}
QJSValuePrivate *jsp = QJSValuePrivate::get(object);
QV4::Scope scope(v4);
QV4::ScopedObject o(scope, jsp->value);
- d_ptr->iterator = v4->newForEachIteratorObject(o)->asReturnedValue();
+ d_ptr->iterator.set(v4, v4->newForEachIteratorObject(o));
QV4::Scoped<QV4::ForEachIteratorObject> it(scope, d_ptr->iterator.value());
it->d()->it.flags = QV4::ObjectIterator::NoFlags;
QV4::ScopedString nm(scope);
diff --git a/src/qml/jsruntime/qv4debugging.cpp b/src/qml/jsruntime/qv4debugging.cpp
index 85874d1318..9361fa1a23 100644
--- a/src/qml/jsruntime/qv4debugging.cpp
+++ b/src/qml/jsruntime/qv4debugging.cpp
@@ -172,7 +172,7 @@ Debugger::Debugger(QV4::ExecutionEngine *engine)
, m_pauseRequested(false)
, m_haveBreakPoints(false)
, m_breakOnThrow(false)
- , m_returnedValue(Primitive::undefinedValue())
+ , m_returnedValue(engine, Primitive::undefinedValue())
, m_gatherSources(0)
, m_runningJob(0)
{
@@ -230,9 +230,9 @@ void Debugger::resume(Speed speed)
return;
if (!m_returnedValue.isUndefined())
- m_returnedValue = Encode::undefined();
+ m_returnedValue.set(m_engine, Encode::undefined());
- m_currentContext = m_engine->currentContext();
+ m_currentContext.set(m_engine, m_engine->currentContext());
m_stepping = speed;
m_runningCondition.wakeAll();
}
@@ -559,7 +559,7 @@ void Debugger::enteringFunction()
QMutexLocker locker(&m_lock);
if (m_stepping == StepIn) {
- m_currentContext = m_engine->currentContext();
+ m_currentContext.set(m_engine, m_engine->currentContext());
}
}
@@ -571,11 +571,10 @@ void Debugger::leavingFunction(const ReturnedValue &retVal)
QMutexLocker locker(&m_lock);
- Scope scope(m_engine);
if (m_stepping != NotStepping && m_currentContext.asManaged()->d() == m_engine->currentContext()) {
- m_currentContext = m_engine->currentContext()->parent;
+ m_currentContext.set(m_engine, m_engine->currentContext()->parent);
m_stepping = StepOver;
- m_returnedValue = retVal;
+ m_returnedValue.set(m_engine, retVal);
}
}
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp
index 2627e26d4b..56e7717c26 100644
--- a/src/qml/jsruntime/qv4include.cpp
+++ b/src/qml/jsruntime/qv4include.cpp
@@ -53,11 +53,11 @@ QV4Include::QV4Include(const QUrl &url, QV4::ExecutionEngine *engine, QQmlContex
const QV4::ValueRef qmlglobal, const QV4::ValueRef callback)
: v4(engine), m_network(0), m_reply(0), m_url(url), m_redirectCount(0), m_context(context)
{
- m_qmlglobal = qmlglobal;
+ m_qmlglobal.set(engine, qmlglobal);
if (callback->asFunctionObject())
- m_callbackFunction = callback;
+ m_callbackFunction.set(engine, callback);
- m_resultObject = resultValue(v4);
+ m_resultObject.set(v4, resultValue(v4));
m_network = engine->v8Engine->networkAccessManager();
diff --git a/src/qml/jsruntime/qv4persistent.cpp b/src/qml/jsruntime/qv4persistent.cpp
index af15804e1f..1236d2a469 100644
--- a/src/qml/jsruntime/qv4persistent.cpp
+++ b/src/qml/jsruntime/qv4persistent.cpp
@@ -33,16 +33,17 @@
#include "qv4persistent_p.h"
#include "qv4mm_p.h"
+#include "qv4object_p.h"
using namespace QV4;
-PersistentValue::PersistentValue(const ValueRef val)
- : d(new PersistentValuePrivate(val.asReturnedValue()))
+PersistentValue::PersistentValue(ExecutionEngine *engine, const ValueRef val)
+ : d(new PersistentValuePrivate(val.asReturnedValue(), engine))
{
}
-PersistentValue::PersistentValue(ReturnedValue val)
- : d(new PersistentValuePrivate(val))
+PersistentValue::PersistentValue(ExecutionEngine *engine, ReturnedValue val)
+ : d(new PersistentValuePrivate(val, engine))
{
}
@@ -53,6 +54,12 @@ PersistentValue::PersistentValue(const PersistentValue &other)
d->ref();
}
+PersistentValue::~PersistentValue()
+{
+ if (d)
+ d->deref();
+}
+
PersistentValue &PersistentValue::operator=(const PersistentValue &other)
{
if (d == other.d)
@@ -69,45 +76,48 @@ PersistentValue &PersistentValue::operator=(const PersistentValue &other)
return *this;
}
-PersistentValue &PersistentValue::operator =(const ValueRef other)
+PersistentValue &PersistentValue::operator=(const WeakValue &other)
{
- if (!d) {
- d = new PersistentValuePrivate(other.asReturnedValue());
- return *this;
- }
- d = d->detach(other.asReturnedValue());
+ QV4::ExecutionEngine *engine = other.engine();
+ if (!d)
+ d = new PersistentValuePrivate(other.value(), engine);
+ else
+ d = d->detach(other.value());
return *this;
}
-PersistentValue &PersistentValue::operator =(ReturnedValue other)
+PersistentValue &PersistentValue::operator=(Object *object)
{
- if (!d) {
- d = new PersistentValuePrivate(other);
- return *this;
- }
- d = d->detach(other);
+ QV4::ExecutionEngine *engine = object->engine();
+ if (!d)
+ d = new PersistentValuePrivate(object->asReturnedValue(), engine);
+ else
+ d = d->detach(object->asReturnedValue());
return *this;
}
-PersistentValue &PersistentValue::operator=(Heap::Base *obj)
+void PersistentValue::set(ExecutionEngine *engine, const ValueRef val)
{
- if (!d) {
- d = new PersistentValuePrivate(Value::fromHeapObject(obj).asReturnedValue());
- return *this;
- }
- d = d->detach(Value::fromHeapObject(obj).asReturnedValue());
- return *this;
+ if (!d)
+ d = new PersistentValuePrivate(val.asReturnedValue(), engine);
+ else
+ d = d->detach(val.asReturnedValue());
}
-PersistentValue::~PersistentValue()
+void PersistentValue::set(ExecutionEngine *engine, ReturnedValue val)
{
- if (d)
- d->deref();
+ if (!d)
+ d = new PersistentValuePrivate(val, engine);
+ else
+ d = d->detach(val);
}
-WeakValue::WeakValue(const ValueRef val)
- : d(new PersistentValuePrivate(val.asReturnedValue(), /*engine*/0, /*weak*/true))
+void PersistentValue::set(ExecutionEngine *engine, Heap::Base *obj)
{
+ if (!d)
+ d = new PersistentValuePrivate(obj->asReturnedValue(), engine);
+ else
+ d = d->detach(obj->asReturnedValue());
}
WeakValue::WeakValue(const WeakValue &other)
@@ -117,11 +127,6 @@ WeakValue::WeakValue(const WeakValue &other)
d->ref();
}
-WeakValue::WeakValue(ReturnedValue val)
- : d(new PersistentValuePrivate(val, /*engine*/0, /*weak*/true))
-{
-}
-
WeakValue &WeakValue::operator=(const WeakValue &other)
{
if (d == other.d)
@@ -138,31 +143,34 @@ WeakValue &WeakValue::operator=(const WeakValue &other)
return *this;
}
-WeakValue &WeakValue::operator =(const ValueRef other)
+WeakValue::~WeakValue()
{
- if (!d) {
- d = new PersistentValuePrivate(other.asReturnedValue(), /*engine*/0, /*weak*/true);
- return *this;
- }
- d = d->detach(other.asReturnedValue(), /*weak*/true);
- return *this;
+ if (d)
+ d->deref();
}
-WeakValue &WeakValue::operator =(const ReturnedValue &other)
+void WeakValue::set(ExecutionEngine *e, const ValueRef val)
{
- if (!d) {
- d = new PersistentValuePrivate(other, /*engine*/0, /*weak*/true);
- return *this;
- }
- d = d->detach(other, /*weak*/true);
- return *this;
+ if (!d)
+ d = new PersistentValuePrivate(val.asReturnedValue(), e, /*weak*/true);
+ else
+ d = d->detach(val.asReturnedValue(), /*weak*/true);
}
+void WeakValue::set(ExecutionEngine *e, ReturnedValue val)
+{
+ if (!d)
+ d = new PersistentValuePrivate(val, e, /*weak*/true);
+ else
+ d = d->detach(val, /*weak*/true);
+}
-WeakValue::~WeakValue()
+void WeakValue::set(ExecutionEngine *e, Heap::Base *obj)
{
- if (d)
- d->deref();
+ if (!d)
+ d = new PersistentValuePrivate(obj->asReturnedValue(), e, /*weak*/true);
+ else
+ d = d->detach(obj->asReturnedValue(), /*weak*/true);
}
void WeakValue::markOnce(ExecutionEngine *e)
diff --git a/src/qml/jsruntime/qv4persistent_p.h b/src/qml/jsruntime/qv4persistent_p.h
index 9ccab914a7..41c482fbb7 100644
--- a/src/qml/jsruntime/qv4persistent_p.h
+++ b/src/qml/jsruntime/qv4persistent_p.h
@@ -71,15 +71,17 @@ public:
PersistentValue() : d(0) {}
PersistentValue(const PersistentValue &other);
PersistentValue &operator=(const PersistentValue &other);
-
- PersistentValue(const ValueRef val);
- PersistentValue(ReturnedValue val);
- PersistentValue &operator=(const ValueRef other);
- PersistentValue &operator=(const ScopedValue &other);
- PersistentValue &operator =(ReturnedValue other);
- PersistentValue &operator=(Heap::Base *obj);
+ PersistentValue &operator=(const WeakValue &other);
+ PersistentValue &operator=(Object *object);
~PersistentValue();
+ PersistentValue(ExecutionEngine *engine, const ValueRef val);
+ PersistentValue(ExecutionEngine *engine, ReturnedValue val);
+
+ void set(ExecutionEngine *engine, const ValueRef val);
+ void set(ExecutionEngine *engine, ReturnedValue val);
+ void set(ExecutionEngine *engine, Heap::Base *obj);
+
ReturnedValue value() const {
return (d ? d->value.asReturnedValue() : Primitive::undefinedValue().asReturnedValue());
}
@@ -89,7 +91,7 @@ public:
return d->value.asManaged();
}
- ExecutionEngine *engine() {
+ ExecutionEngine *engine() const {
if (!d)
return 0;
if (d->engine)
@@ -113,20 +115,19 @@ class Q_QML_EXPORT WeakValue
{
public:
WeakValue() : d(0) {}
- WeakValue(const ValueRef val);
WeakValue(const WeakValue &other);
- WeakValue(ReturnedValue val);
WeakValue &operator=(const WeakValue &other);
- WeakValue &operator=(const ValueRef other);
- WeakValue &operator =(const ReturnedValue &other);
-
~WeakValue();
+ void set(ExecutionEngine *e, const ValueRef val);
+ void set(ExecutionEngine *e, ReturnedValue val);
+ void set(ExecutionEngine *e, Heap::Base *obj);
+
ReturnedValue value() const {
return (d ? d->value.asReturnedValue() : Primitive::undefinedValue().asReturnedValue());
}
- ExecutionEngine *engine() {
+ ExecutionEngine *engine() const {
if (!d)
return 0;
if (d->engine)
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 284d20d975..7ec66dd0e5 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -593,7 +593,7 @@ ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *object)
!ddata->hasTaintedV8Object)) { // Someone else has used the QObject, but it isn't tainted
QV4::ScopedValue rv(scope, create(engine, object));
- ddata->jsWrapper = rv;
+ ddata->jsWrapper.set(scope.engine, rv);
ddata->jsEngineId = engine->m_engineId;
return rv.asReturnedValue();
@@ -608,7 +608,7 @@ ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *object)
// a handle in the ddata, we can assume ownership of the ddata->v8object
if (ddata->jsWrapper.isUndefined() && !alternateWrapper) {
QV4::ScopedValue result(scope, create(engine, object));
- ddata->jsWrapper = result;
+ ddata->jsWrapper.set(scope.engine, result);
ddata->jsEngineId = engine->m_engineId;
return result.asReturnedValue();
}
@@ -919,8 +919,8 @@ ReturnedValue QObjectWrapper::method_connect(CallContext *ctx)
QV4::QObjectSlotDispatcher *slot = new QV4::QObjectSlotDispatcher;
slot->signalIndex = signalIndex;
- slot->thisObject = thisObject;
- slot->function = f;
+ slot->thisObject.set(scope.engine, thisObject);
+ slot->function.set(scope.engine, f);
if (QQmlData *ddata = QQmlData::get(signalObject)) {
if (QQmlPropertyCache *propertyCache = ddata->propertyCache) {
diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h
index 3a16eb73ce..e12b91340d 100644
--- a/src/qml/jsruntime/qv4scopedvalue_p.h
+++ b/src/qml/jsruntime/qv4scopedvalue_p.h
@@ -468,11 +468,6 @@ inline TypedValue<T> &TypedValue<T>::operator=(const TypedValue<T> &t)
return *this;
}
-inline PersistentValue &PersistentValue::operator=(const ScopedValue &other)
-{
- return operator=(other.asReturnedValue());
-}
-
inline ValueRef::ValueRef(const ScopedValue &v)
: ptr(v.ptr)
{}
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 6882061f6b..e8471ca019 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -193,7 +193,7 @@ Heap::FunctionObject *QmlBindingWrapper::createQmlCallableForFunction(QQmlContex
Script::Script(ExecutionEngine *v4, Object *qml, CompiledData::CompilationUnit *compilationUnit)
: line(0), column(0), scope(v4->rootContext()), strictMode(false), inheritContext(true), parsed(false)
- , qml(qml->asReturnedValue()), vmFunction(0), parseAsBinding(true)
+ , qml(v4, qml->asReturnedValue()), vmFunction(0), parseAsBinding(true)
{
parsed = true;
@@ -201,7 +201,7 @@ Script::Script(ExecutionEngine *v4, Object *qml, CompiledData::CompilationUnit *
if (vmFunction) {
Scope valueScope(v4);
ScopedObject holder(valueScope, v4->memoryManager->alloc<CompilationUnitHolder>(v4, compilationUnit));
- compilationUnitHolder = holder.asReturnedValue();
+ compilationUnitHolder.set(v4, holder);
}
}
@@ -272,7 +272,7 @@ void Script::parse()
QQmlRefPointer<QV4::CompiledData::CompilationUnit> compilationUnit = isel->compile();
vmFunction = compilationUnit->linkToEngine(v4);
ScopedObject holder(valueScope, v4->memoryManager->alloc<CompilationUnitHolder>(v4, compilationUnit));
- compilationUnitHolder = holder.asReturnedValue();
+ compilationUnitHolder.set(v4, holder);
}
if (!vmFunction) {
diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h
index 894859ce5e..f2fd9cb7fc 100644
--- a/src/qml/jsruntime/qv4script_p.h
+++ b/src/qml/jsruntime/qv4script_p.h
@@ -118,7 +118,7 @@ struct Q_QML_EXPORT Script {
Script(ExecutionEngine *engine, Object *qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
: sourceFile(source), line(line), column(column), sourceCode(sourceCode)
, scope(engine->rootContext()), strictMode(false), inheritContext(true), parsed(false)
- , qml(qml->asReturnedValue()), vmFunction(0), parseAsBinding(true) {}
+ , qml(engine, qml->asReturnedValue()), vmFunction(0), parseAsBinding(true) {}
Script(ExecutionEngine *engine, Object *qml, CompiledData::CompilationUnit *compilationUnit);
~Script();
QString sourceFile;
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 3de29551ff..91fa2aa7bd 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -74,7 +74,8 @@ QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContext *ctxt)
QQmlAbstractExpression::setContext(QQmlContextData::get(ctxt));
setScopeObject(obj);
- v4function = qmlBinding(context(), obj, str, QString(), 0);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(context()->engine)->v4engine();
+ v4function.set(v4, qmlBinding(context(), obj, str, QString(), 0));
}
QQmlBinding::QQmlBinding(const QQmlScriptString &script, QObject *obj, QQmlContext *ctxt)
@@ -102,11 +103,12 @@ QQmlBinding::QQmlBinding(const QQmlScriptString &script, QObject *obj, QQmlConte
QQmlAbstractExpression::setContext(QQmlContextData::get(ctxt ? ctxt : scriptPrivate->context));
setScopeObject(obj ? obj : scriptPrivate->scope);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(context()->engine)->v4engine();
if (runtimeFunction) {
- v4function = QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxtdata, scopeObject(), runtimeFunction);
+ v4function.set(v4, QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxtdata, scopeObject(), runtimeFunction));
} else {
QString code = scriptPrivate->script;
- v4function = qmlBinding(context(), scopeObject(), code, url, scriptPrivate->lineNumber);
+ v4function.set(v4, qmlBinding(context(), scopeObject(), code, url, scriptPrivate->lineNumber));
}
}
@@ -117,7 +119,8 @@ QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContextData *ctxt
QQmlAbstractExpression::setContext(ctxt);
setScopeObject(obj);
- v4function = qmlBinding(ctxt, obj, str, QString(), 0);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(context()->engine)->v4engine();
+ v4function.set(v4, qmlBinding(ctxt, obj, str, QString(), 0));
}
QQmlBinding::QQmlBinding(const QString &str, QObject *obj,
@@ -130,7 +133,8 @@ QQmlBinding::QQmlBinding(const QString &str, QObject *obj,
QQmlAbstractExpression::setContext(ctxt);
setScopeObject(obj);
- v4function = qmlBinding(ctxt, obj, str, url, lineNumber);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(context()->engine)->v4engine();
+ v4function.set(v4, qmlBinding(ctxt, obj, str, url, lineNumber));
}
QQmlBinding::QQmlBinding(const QV4::ValueRef functionPtr, QObject *obj, QQmlContextData *ctxt)
@@ -140,7 +144,7 @@ QQmlBinding::QQmlBinding(const QV4::ValueRef functionPtr, QObject *obj, QQmlCont
QQmlAbstractExpression::setContext(ctxt);
setScopeObject(obj);
- v4function = functionPtr;
+ v4function.set(functionPtr->asObject()->engine(), functionPtr);
}
QQmlBinding::~QQmlBinding()
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index 1703d0fbd5..811efcaef5 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -89,7 +89,7 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index, QQmlContextData *ctxt, QObject *scope, const QV4::ValueRef &function)
: QQmlJavaScriptExpression(&QQmlBoundSignalExpression_jsvtable),
m_index(index),
- m_v8function(function),
+ m_function(function->asObject()->engine(), function),
m_target(target),
m_extra(0)
{
@@ -113,7 +113,8 @@ QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *target, int index,
QMetaMethod signal = QMetaObjectPrivate::signal(m_target->metaObject(), m_index);
QString error;
- m_v8function = QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxt, scope, runtimeFunction, signal.parameterNames(), &error);
+ QV4::ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(ctxt->engine);
+ m_function.set(engine, QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxt, scope, runtimeFunction, signal.parameterNames(), &error));
if (!error.isEmpty()) {
qmlInfo(scopeObject()) << error;
setInvalidParameterName(true);
@@ -168,7 +169,7 @@ QString QQmlBoundSignalExpression::expression() const
if (expressionFunctionValid()) {
Q_ASSERT (context() && engine());
QV4::Scope scope(QQmlEnginePrivate::get(engine())->v4engine());
- QV4::ScopedValue v(scope, m_v8function.value());
+ QV4::ScopedValue v(scope, m_function.value());
return v->toQStringNoThrow();
} else {
Q_ASSERT(!m_extra.isNull());
@@ -181,7 +182,7 @@ QV4::Function *QQmlBoundSignalExpression::function() const
if (expressionFunctionValid()) {
Q_ASSERT (context() && engine());
QV4::Scope scope(QQmlEnginePrivate::get(engine())->v4engine());
- QV4::ScopedFunctionObject v(scope, m_v8function.value());
+ QV4::ScopedFunctionObject v(scope, m_function.value());
return v ? v->function() : 0;
}
return 0;
@@ -236,10 +237,10 @@ void QQmlBoundSignalExpression::evaluate(void **a)
m_extra->m_handlerName.clear();
m_extra->m_parameterString.clear();
- m_v8function = evalFunction(context(), scopeObject(), expression,
- m_extra->m_sourceLocation.sourceFile, m_extra->m_sourceLocation.line, &m_extra->m_v8qmlscope);
+ m_function.set(scope.engine, evalFunction(context(), scopeObject(), expression,
+ m_extra->m_sourceLocation.sourceFile, m_extra->m_sourceLocation.line, &m_extra->m_v8qmlscope));
- if (m_v8function.isNullOrUndefined()) {
+ if (m_function.isNullOrUndefined()) {
ep->dereferenceScarceResources();
return; // could not evaluate function. Not valid.
}
@@ -253,7 +254,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
int *argsTypes = QQmlMetaObject(m_target).methodParameterTypes(methodIndex, dummy, 0);
int argCount = argsTypes ? *argsTypes : 0;
- QV4::ScopedValue f(scope, m_v8function.value());
+ QV4::ScopedValue f(scope, m_function.value());
QV4::ScopedCallData callData(scope, argCount);
for (int ii = 0; ii < argCount; ++ii) {
int type = argsTypes[ii + 1];
diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h
index d2fec2afc8..6e0fbe90e6 100644
--- a/src/qml/qml/qqmlboundsignal_p.h
+++ b/src/qml/qml/qqmlboundsignal_p.h
@@ -99,7 +99,7 @@ private:
void setInvalidParameterName(bool v) { m_extra.setFlag2Value(v); }
int m_index;
- QV4::PersistentValue m_v8function;
+ QV4::PersistentValue m_function;
QObject *m_target;
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index fd43898770..8f146b7a8a 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1414,7 +1414,7 @@ QQmlComponentExtension::QQmlComponentExtension(QV4::ExecutionEngine *v4)
proto->defineAccessorProperty(QStringLiteral("object"), QV4::QmlIncubatorObject::method_get_object, 0);
proto->defineDefaultProperty(QStringLiteral("forceCompletion"), QV4::QmlIncubatorObject::method_forceCompletion);
- incubationProto = proto;
+ incubationProto.set(v4, proto);
}
QV4::ReturnedValue QV4::QmlIncubatorObject::method_get_object(QV4::CallContext *ctx)
diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp
index 1e31a8f638..ba561ad8e5 100644
--- a/src/qml/qml/qqmlexpression.cpp
+++ b/src/qml/qml/qqmlexpression.cpp
@@ -73,7 +73,8 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr, QOb
void QQmlExpressionPrivate::init(QQmlContextData *ctxt, QV4::Function *runtimeFunction, QObject *me)
{
expressionFunctionValid = true;
- function = QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxt, me, runtimeFunction);
+ QV4::ExecutionEngine *engine = QQmlEnginePrivate::getV4Engine(ctxt->engine);
+ function.set(engine, QV4::QmlBindingWrapper::createQmlCallableForFunction(ctxt, me, runtimeFunction));
QQmlAbstractExpression::setContext(ctxt);
setScopeObject(me);
@@ -247,12 +248,13 @@ QV4::ReturnedValue QQmlExpressionPrivate::v4value(bool *isUndefined)
{
Q_Q(QQmlExpression);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(q->engine())->v4engine();
+
if (!expressionFunctionValid) {
- function = qmlBinding(context(), scopeObject(), expression, url, line, &qmlscope);
+ function.set(v4, qmlBinding(context(), scopeObject(), expression, url, line, &qmlscope));
expressionFunctionValid = true;
}
- QV4::ExecutionEngine *v4 = QQmlEnginePrivate::get(q->engine())->v4engine();
QV4::Scope scope(v4);
QV4::ScopedValue f(scope, function.value());
return evaluate(context(), f, isUndefined);
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 1745a338f3..5f8190b8dc 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -308,7 +308,7 @@ QQmlJavaScriptExpression::evalFunction(QQmlContextData *ctxt, QObject *scopeObje
return QV4::Encode::undefined();
}
if (qmlscope)
- *qmlscope = qmlScopeObject;
+ qmlscope->set(v4, qmlScopeObject);
return result.asReturnedValue();
}
@@ -341,7 +341,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::qmlBinding(QQmlContextData *ctxt, Q
return QV4::Encode::undefined();
}
if (qmlscope)
- *qmlscope = qmlScopeObject;
+ qmlscope->set(v4, qmlScopeObject);
return result.asReturnedValue();
}
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp
index 06c446fc3b..05cfd2e2a1 100644
--- a/src/qml/qml/qqmllocale.cpp
+++ b/src/qml/qml/qqmllocale.cpp
@@ -683,7 +683,7 @@ QV4LocaleDataDeletable::QV4LocaleDataDeletable(QV4::ExecutionEngine *engine)
o->defineAccessorProperty(QStringLiteral("measurementSystem"), QQmlLocaleData::method_get_measurementSystem, 0);
o->defineAccessorProperty(QStringLiteral("exponential"), QQmlLocaleData::method_get_exponential, 0);
- prototype = o;
+ prototype.set(engine, o);
}
QV4LocaleDataDeletable::~QV4LocaleDataDeletable()
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index f564cd235e..8c34fc3997 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -208,7 +208,7 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI
if (subComponentIndex == -1) {
QV4::ScopedObject scripts(scope, v4->newArrayObject(compiledData->scripts.count()));
- context->importedScripts = scripts;
+ context->importedScripts.set(v4, scripts);
for (int i = 0; i < compiledData->scripts.count(); ++i) {
QQmlScriptData *s = compiledData->scripts.at(i);
scripts->putIndexed(i, s->scriptValueForContext(context));
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 4b7fe9eb04..2a000e34e1 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2504,7 +2504,7 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
QV4::ScopedObject scriptsArray(scope);
if (ctxt->importedScripts.isNullOrUndefined()) {
scriptsArray = v4->newArrayObject(scripts.count());
- ctxt->importedScripts = scriptsArray;
+ ctxt->importedScripts.set(v4, scriptsArray);
} else {
scriptsArray = ctxt->importedScripts;
}
@@ -2523,7 +2523,7 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
QV4::ScopedValue qmlglobal(scope, QV4::QmlContextWrapper::qmlScope(v4, ctxt, 0));
QV4::QmlContextWrapper::takeContextOwnership(qmlglobal);
- m_program->qml = qmlglobal;
+ m_program->qml.set(scope.engine, qmlglobal);
m_program->run();
if (scope.engine->hasException) {
QQmlError error = scope.engine->catchExceptionAsQmlError();
@@ -2531,7 +2531,7 @@ QV4::PersistentValue QQmlScriptData::scriptValueForContext(QQmlContextData *pare
ep->warning(error);
}
- rv = qmlglobal;
+ rv.set(scope.engine, qmlglobal);
if (shared) {
m_value = rv;
m_loaded = true;
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index 6636b3a8e4..40ae8ce35a 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -608,7 +608,7 @@ QQmlVMEMetaObject::QQmlVMEMetaObject(QObject *obj,
QV4::Function *runtimeFunction = compilationUnit->runtimeFunctions[data->runtimeFunctionIndex];
o = QV4::FunctionObject::createScriptFunction(qmlBindingContext, runtimeFunction);
- v8methods[index] = o;
+ v8methods[index].set(qmlBindingContext->engine(), o);
}
}
}
@@ -1183,7 +1183,7 @@ void QQmlVMEMetaObject::setVmeMethod(int index, QV4::ValueRef function)
v8methods = new QV4::PersistentValue[metaData->methodCount];
int methodIndex = index - methodOffset() - plainSignals;
- v8methods[methodIndex] = function;
+ v8methods[methodIndex].set(function->asObject()->engine(), function);
}
QV4::ReturnedValue QQmlVMEMetaObject::vmeProperty(int index)
@@ -1253,7 +1253,7 @@ void QQmlVMEMetaObject::allocateVarPropertiesArray()
assert(qml);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(qml->handle());
QV4::Scope scope(v4);
- varProperties = QV4::ScopedValue(scope, v4->newArrayObject(metaData->varPropertyCount));
+ varProperties.set(scope.engine, v4->newArrayObject(metaData->varPropertyCount));
varPropertiesInitialized = true;
}
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 6b38b03357..f5451a2976 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -589,7 +589,7 @@ ReturnedValue NodePrototype::getProto(ExecutionEngine *v4)
QQmlXMLHttpRequestData *d = xhrdata(v4);
if (d->nodePrototype.isUndefined()) {
ScopedObject p(scope, v4->memoryManager->alloc<NodePrototype>(v4));
- d->nodePrototype = p;
+ d->nodePrototype.set(v4, p);
v4->v8Engine->freezeObject(p);
}
return d->nodePrototype.value();
@@ -638,7 +638,7 @@ ReturnedValue Element::prototype(ExecutionEngine *engine)
ScopedObject pp(scope);
p->setPrototype((pp = NodePrototype::getProto(engine)));
p->defineAccessorProperty(QStringLiteral("tagName"), NodePrototype::method_get_nodeName, 0);
- d->elementPrototype = p;
+ d->elementPrototype.set(engine, p);
engine->v8Engine->freezeObject(p);
}
return d->elementPrototype.value();
@@ -655,7 +655,7 @@ ReturnedValue Attr::prototype(ExecutionEngine *engine)
p->defineAccessorProperty(QStringLiteral("name"), method_name, 0);
p->defineAccessorProperty(QStringLiteral("value"), method_value, 0);
p->defineAccessorProperty(QStringLiteral("ownerElement"), method_ownerElement, 0);
- d->attrPrototype = p;
+ d->attrPrototype.set(engine, p);
engine->v8Engine->freezeObject(p);
}
return d->attrPrototype.value();
@@ -711,7 +711,7 @@ ReturnedValue CharacterData::prototype(ExecutionEngine *v4)
p->setPrototype((pp = NodePrototype::getProto(v4)));
p->defineAccessorProperty(QStringLiteral("data"), NodePrototype::method_get_nodeValue, 0);
p->defineAccessorProperty(QStringLiteral("length"), method_length, 0);
- d->characterDataPrototype = p;
+ d->characterDataPrototype.set(v4, p);
v4->v8Engine->freezeObject(p);
}
return d->characterDataPrototype.value();
@@ -746,7 +746,7 @@ ReturnedValue Text::prototype(ExecutionEngine *v4)
p->setPrototype((pp = CharacterData::prototype(v4)));
p->defineAccessorProperty(QStringLiteral("isElementContentWhitespace"), method_isElementContentWhitespace, 0);
p->defineAccessorProperty(QStringLiteral("wholeText"), method_wholeText, 0);
- d->textPrototype = p;
+ d->textPrototype.set(v4, p);
v4->v8Engine->freezeObject(p);
}
return d->textPrototype.value();
@@ -761,7 +761,7 @@ ReturnedValue CDATA::prototype(ExecutionEngine *v4)
ScopedObject p(scope, v4->newObject());
ScopedObject pp(scope);
p->setPrototype((pp = Text::prototype(v4)));
- d->cdataPrototype = p;
+ d->cdataPrototype.set(v4, p);
v4->v8Engine->freezeObject(p);
}
return d->cdataPrototype.value();
@@ -779,7 +779,7 @@ ReturnedValue Document::prototype(ExecutionEngine *v4)
p->defineAccessorProperty(QStringLiteral("xmlEncoding"), method_xmlEncoding, 0);
p->defineAccessorProperty(QStringLiteral("xmlStandalone"), method_xmlStandalone, 0);
p->defineAccessorProperty(QStringLiteral("documentElement"), method_documentElement, 0);
- d->documentPrototype = p;
+ d->documentPrototype.set(v4, p);
v4->v8Engine->freezeObject(p);
}
return d->documentPrototype.value();
@@ -1308,7 +1308,7 @@ ReturnedValue QQmlXMLHttpRequest::getMe() const
void QQmlXMLHttpRequest::setMe(const ValueRef me)
{
- m_me = me;
+ m_me.set(v4, me);
}
void QQmlXMLHttpRequest::readyRead()
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index 9ea17d8418..d0c8c08fce 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -217,7 +217,7 @@ void QV8Engine::initializeGlobal()
QV4::ScopedFunctionObject result(scope, QV4::Script::evaluate(m_v4Engine, QString::fromUtf8(FREEZE_SOURCE), 0));
Q_ASSERT(!!result);
- m_freezeObject = result;
+ m_freezeObject.set(scope.engine, result);
#undef FREEZE_SOURCE
}
}
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index 88cb086d32..8309df8403 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -1757,7 +1757,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype()
p->setSetter(0);
proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable);
}
- modelItemProto = proto;
+ modelItemProto.set(v4, proto);
}
int QQmlDelegateModelItemMetaType::parseGroups(const QStringList &groups) const
@@ -3341,7 +3341,7 @@ QQmlDelegateModelEngineData::QQmlDelegateModelEngineData(QV4::ExecutionEngine *v
proto->defineAccessorProperty(QStringLiteral("index"), QQmlDelegateModelGroupChange::method_get_index, 0);
proto->defineAccessorProperty(QStringLiteral("count"), QQmlDelegateModelGroupChange::method_get_count, 0);
proto->defineAccessorProperty(QStringLiteral("moveId"), QQmlDelegateModelGroupChange::method_get_moveId, 0);
- changeProto = proto;
+ changeProto.set(v4, proto);
}
QQmlDelegateModelEngineData::~QQmlDelegateModelEngineData()
diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp
index b822c155b6..4ad2c34247 100644
--- a/src/qml/types/qquickworkerscript.cpp
+++ b/src/qml/types/qquickworkerscript.cpp
@@ -222,7 +222,7 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init()
QV4::Scope scope(m_v4Engine);
QV4::ScopedContext globalContext(scope, scope.engine->rootContext());
- onmessage = QV4::Script(globalContext, QString::fromUtf8(CALL_ONMESSAGE_SCRIPT)).run(); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro
+ onmessage.set(scope.engine, QV4::Script(globalContext, QString::fromUtf8(CALL_ONMESSAGE_SCRIPT)).run()); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro
Q_ASSERT(!scope.engine->hasException);
QV4::Script createsendscript(globalContext, QString::fromUtf8(SEND_MESSAGE_CREATE_SCRIPT)); // do not use QStringLiteral here, MSVC2012 cannot apply this cleanly to the macro
QV4::ScopedFunctionObject createsendconstructor(scope, createsendscript.run());
@@ -233,7 +233,7 @@ void QQuickWorkerScriptEnginePrivate::WorkerEngine::init()
QV4::ScopedCallData callData(scope, 1);
callData->args[0] = function;
callData->thisObject = global();
- createsend = createsendconstructor->call(callData);
+ createsend.set(scope.engine, createsendconstructor->call(callData));
}
// Requires handle and context scope
@@ -300,7 +300,7 @@ QV4::ReturnedValue QQuickWorkerScriptEnginePrivate::getWorker(WorkerScript *scri
QV4::ExecutionEngine *v4 = QV8Engine::getV4(workerEngine);
QV4::Scope scope(v4);
- script->object = QV4::QmlContextWrapper::urlScope(v4, script->source);
+ script->object.set(v4, QV4::QmlContextWrapper::urlScope(v4, script->source));
QV4::Scoped<QV4::QmlContextWrapper> w(scope, script->object.value());
Q_ASSERT(!!w);
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index 1a7c5ca0d4..4cf34ae078 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -226,7 +226,7 @@ public:
p->setSetter(s);
proto->insertMember(name, p, QV4::Attr_Accessor|QV4::Attr_NotEnumerable|QV4::Attr_NotConfigurable);
}
- prototype = proto;
+ prototype.set(v4, proto);
}
// QAbstractDynamicMetaObject
@@ -963,7 +963,7 @@ QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4)
proto->defineAccessorProperty(QStringLiteral("index"), get_index, 0);
proto->defineAccessorProperty(QStringLiteral("modelData"),
QQmlDMListAccessorData::get_modelData, QQmlDMListAccessorData::set_modelData);
- listItemProto = proto;
+ listItemProto.set(v4, proto);
}
QQmlAdaptorModelEngineData::~QQmlAdaptorModelEngineData()
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 2688c723ed..f8ed81d2a5 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -864,7 +864,7 @@ void QQuickCanvasItem::requestAnimationFrame(QQmlV4Function *args)
static int id = 0;
- d->animationCallbacks.insert(++id, QV4::PersistentValue(f));
+ d->animationCallbacks.insert(++id, QV4::PersistentValue(scope.engine, f));
if (isVisible())
polish();
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index e46aa53755..da4212e5b1 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -1390,13 +1390,13 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::CallContext *ctx
if (color.isValid()) {
r->d()->context->state.fillStyle = color;
r->d()->context->buffer()->setFillStyle(color);
- r->d()->context->m_fillStyle = value;
+ r->d()->context->m_fillStyle.set(scope.engine, value);
} else {
QV4::Scoped<QQuickContext2DStyle> style(scope, value->as<QQuickContext2DStyle>());
if (style && style->d()->brush != r->d()->context->state.fillStyle) {
r->d()->context->state.fillStyle = style->d()->brush;
r->d()->context->buffer()->setFillStyle(style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY);
- r->d()->context->m_fillStyle = value;
+ r->d()->context->m_fillStyle.set(scope.engine, value);
r->d()->context->state.fillPatternRepeatX = style->d()->patternRepeatX;
r->d()->context->state.fillPatternRepeatY = style->d()->patternRepeatY;
}
@@ -1406,7 +1406,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(QV4::CallContext *ctx
if (color.isValid() && r->d()->context->state.fillStyle != QBrush(color)) {
r->d()->context->state.fillStyle = QBrush(color);
r->d()->context->buffer()->setFillStyle(r->d()->context->state.fillStyle);
- r->d()->context->m_fillStyle = value;
+ r->d()->context->m_fillStyle.set(scope.engine, value);
}
}
return QV4::Encode::undefined();
@@ -1499,13 +1499,13 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::CallContext *c
if (color.isValid()) {
r->d()->context->state.fillStyle = color;
r->d()->context->buffer()->setStrokeStyle(color);
- r->d()->context->m_strokeStyle = value;
+ r->d()->context->m_strokeStyle.set(scope.engine, value);
} else {
QV4::Scoped<QQuickContext2DStyle> style(scope, value->as<QQuickContext2DStyle>());
if (style && style->d()->brush != r->d()->context->state.strokeStyle) {
r->d()->context->state.strokeStyle = style->d()->brush;
r->d()->context->buffer()->setStrokeStyle(style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY);
- r->d()->context->m_strokeStyle = value;
+ r->d()->context->m_strokeStyle.set(scope.engine, value);
r->d()->context->state.strokePatternRepeatX = style->d()->patternRepeatX;
r->d()->context->state.strokePatternRepeatY = style->d()->patternRepeatY;
@@ -1516,7 +1516,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(QV4::CallContext *c
if (color.isValid() && r->d()->context->state.strokeStyle != QBrush(color)) {
r->d()->context->state.strokeStyle = QBrush(color);
r->d()->context->buffer()->setStrokeStyle(r->d()->context->state.strokeStyle);
- r->d()->context->m_strokeStyle = value;
+ r->d()->context->m_strokeStyle.set(scope.engine, value);
}
}
return QV4::Encode::undefined();
@@ -2076,7 +2076,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_path(QV4::CallContext *ctx)
QString path =value->toQStringNoThrow();
QQuickSvgParser::parsePathDataFast(path, r->d()->context->m_path);
}
- r->d()->context->m_v4path = value;
+ r->d()->context->m_v4path.set(scope.engine, value);
return QV4::Encode::undefined();
}
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index 906126b433..4123f25b7e 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -466,7 +466,7 @@ void QQuickLoader::setSourceComponent(QQmlComponent *comp)
d->component = comp;
if (comp) {
if (QQmlData *ddata = QQmlData::get(comp))
- d->componentStrongReference = ddata->jsWrapper.value();
+ d->componentStrongReference = ddata->jsWrapper;
}
d->loadingFromSource = false;
@@ -574,8 +574,8 @@ void QQuickLoader::setSource(QQmlV4Function *args)
QUrl sourceUrl = d->resolveSourceUrl(args);
if (!ipv->isUndefined()) {
d->disposeInitialPropertyValues();
- d->initialPropertyValues = ipv.asReturnedValue();
- d->qmlGlobalForIpv = args->qmlGlobal();
+ d->initialPropertyValues.set(args->v4engine(), ipv);
+ d->qmlGlobalForIpv.set(args->v4engine(), args->qmlGlobal());
}
setSource(sourceUrl, false); // already cleared and set ipv above.
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
index 0a16457e0e..245fa488c4 100644
--- a/src/quick/items/qquickview.cpp
+++ b/src/quick/items/qquickview.cpp
@@ -83,7 +83,7 @@ void QQuickViewPrivate::init(QQmlEngine* e)
QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine.data());
QV4::Scope scope(v4);
QV4::Scoped<QV4::QQuickRootItemMarker> v(scope, QV4::QQuickRootItemMarker::create(engine.data(), q));
- rootItemMarker = v;
+ rootItemMarker.set(v4, v);
}
if (QQmlDebugService::isDebuggingEnabled())