aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4engine.cpp10
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp3
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp3
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp3
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp3
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4sparsearray.cpp4
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp8
-rw-r--r--src/qml/jsruntime/qv4variantobject.cpp2
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp4
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp6
11 files changed, 45 insertions, 5 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 41eb6fe5ec..6257d8bac9 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -673,12 +673,16 @@ void ExecutionEngine::requireArgumentsAccessors(int n)
if (n <= argumentsAccessors.size())
return;
+ Scope scope(this);
+ ScopedFunctionObject get(scope);
+ ScopedFunctionObject set(scope);
+
uint oldSize = argumentsAccessors.size();
argumentsAccessors.resize(n);
for (int i = oldSize; i < n; ++i) {
- FunctionObject *get = new (memoryManager) ArgumentsGetterFunction(rootContext, i);
- FunctionObject *set = new (memoryManager) ArgumentsSetterFunction(rootContext, i);
- Property pd = Property::fromAccessor(get, set);
+ get = new (memoryManager) ArgumentsGetterFunction(rootContext, i);
+ set = new (memoryManager) ArgumentsSetterFunction(rootContext, i);
+ Property pd = Property::fromAccessor(get.getPointer(), set.getPointer());
argumentsAccessors[i] = pd;
}
}
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 2295fb5aa8..331b528409 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -881,6 +881,9 @@ JsonObject::JsonObject(ExecutionEngine *engine)
{
type = Type_JSONObject;
+ Scope scope(engine);
+ ScopedObject protectThis(scope, this);
+
defineDefaultProperty(QStringLiteral("parse"), method_parse, 2);
defineDefaultProperty(QStringLiteral("stringify"), method_stringify, 3);
}
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index fcff9e4aca..6280b7c392 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -55,6 +55,9 @@ MathObject::MathObject(ExecutionEngine *engine)
{
type = Type_MathObject;
+ Scope scope(engine);
+ ScopedObject protectThis(scope, this);
+
defineReadonlyProperty(QStringLiteral("E"), Primitive::fromDouble(::exp(1.0)));
defineReadonlyProperty(QStringLiteral("LN2"), Primitive::fromDouble(::log(2.0)));
defineReadonlyProperty(QStringLiteral("LN10"), Primitive::fromDouble(::log(10.0)));
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index d42d842ab7..03d839316b 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -243,6 +243,9 @@ QObjectWrapper::QObjectWrapper(ExecutionEngine *engine, QObject *object)
{
vtbl = &static_vtbl;
+ Scope scope(engine);
+ ScopedObject protectThis(scope, this);
+
m_destroy = engine->newIdentifier(QStringLiteral("destroy"));
}
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 9c7fe94759..4adee433aa 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -132,6 +132,9 @@ RegExpObject::RegExpObject(ExecutionEngine *engine, const QRegExp &re)
pattern = ecmaPattern;
}
+ Scope scope(engine);
+ ScopedObject protectThis(scope, this);
+
value = RegExp::create(engine, pattern, re.caseSensitivity() == Qt::CaseInsensitive, false);
init(engine);
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index c535dbea09..05f51beecf 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -175,6 +175,8 @@ public:
{
type = Type_QmlSequence;
vtbl = &static_vtbl;
+ QV4::Scope scope(engine);
+ QV4::ScopedObject protectThis(scope, this);
init();
}
@@ -186,6 +188,8 @@ public:
{
type = Type_QmlSequence;
vtbl = &static_vtbl;
+ QV4::Scope scope(engine);
+ QV4::ScopedObject protectThis(scope, this);
loadReference();
init();
}
diff --git a/src/qml/jsruntime/qv4sparsearray.cpp b/src/qml/jsruntime/qv4sparsearray.cpp
index a9faf634c9..ec6b0f5ad1 100644
--- a/src/qml/jsruntime/qv4sparsearray.cpp
+++ b/src/qml/jsruntime/qv4sparsearray.cpp
@@ -73,7 +73,9 @@ bool ArrayElementLessThan::operator()(const Property &p1, const Property &p2) co
return result->toNumber() <= 0;
}
- return p1.value.toString(m_context)->toQString() < p2.value.toString(m_context)->toQString();
+ ScopedString p1s(scope, p1.value.toString(m_context));
+ ScopedString p2s(scope, p2.value.toString(m_context));
+ return p1s->toQString() < p2s->toQString();
}
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index 7e503e4b1a..25e1ea55c2 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -82,6 +82,10 @@ StringObject::StringObject(InternalClass *ic)
{
vtbl = &static_vtbl;
type = Type_StringObject;
+
+ Scope scope(engine());
+ ScopedObject protectThis(scope, this);
+
value = ic->engine->newString("")->asReturnedValue();
tmpProperty.value = Primitive::undefinedValue();
@@ -94,6 +98,10 @@ StringObject::StringObject(ExecutionEngine *engine, const ValueRef val)
{
vtbl = &static_vtbl;
type = Type_StringObject;
+
+ Scope scope(engine);
+ ScopedObject protectThis(scope, this);
+
value = *val;
tmpProperty.value = Primitive::undefinedValue();
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp
index 2fe9c717bd..a37da31782 100644
--- a/src/qml/jsruntime/qv4variantobject.cpp
+++ b/src/qml/jsruntime/qv4variantobject.cpp
@@ -66,7 +66,7 @@ VariantObject::VariantObject(ExecutionEngine *engine, const QVariant &value)
{
vtbl = &static_vtbl;
if (isScarce())
- internalClass->engine->scarceResources.insert(this);
+ engine->scarceResources.insert(this);
}
QVariant VariantObject::toVariant(const QV4::ValueRef v)
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index 6aeabf9221..7a251601db 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -259,6 +259,10 @@ public:
: Object(engine)
{
vtbl = &static_vtbl;
+
+ Scope scope(engine);
+ ScopedObject protectThis(scope, this);
+
defineAccessorProperty(QStringLiteral("nodeName"), method_get_nodeName, 0);
defineAccessorProperty(QStringLiteral("nodeValue"), method_get_nodeValue, 0);
defineAccessorProperty(QStringLiteral("nodeType"), method_get_nodeType, 0);
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 6f7cd77486..f7704306d3 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -545,6 +545,9 @@ public:
QQuickJSContext2DPrototype(QV4::ExecutionEngine *engine)
: QV4::Object(engine)
{
+ QV4::Scope scope(engine);
+ QV4::ScopedObject protectThis(scope, this);
+
defineDefaultProperty(QStringLiteral("quadraticCurveTo"), method_quadraticCurveTo, 0);
defineDefaultProperty(QStringLiteral("restore"), method_restore, 0);
defineDefaultProperty(QStringLiteral("moveTo"), method_moveTo, 0);
@@ -891,6 +894,9 @@ struct QQuickJSContext2DImageData : public QV4::Object
{
vtbl = &static_vtbl;
+ QV4::Scope scope(engine);
+ QV4::ScopedObject protectThis(scope, this);
+
defineAccessorProperty(QStringLiteral("width"), method_get_width, 0);
defineAccessorProperty(QStringLiteral("height"), method_get_height, 0);
defineAccessorProperty(QStringLiteral("data"), method_get_data, 0);