aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4stringobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4stringobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp8
1 files changed, 8 insertions, 0 deletions
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();