summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2011-02-25 14:33:47 (GMT)
committerKent Hansen <kent.hansen@nokia.com>2011-02-25 14:55:08 (GMT)
commit2af7bc6259e41415817cadb456909f33249225ed (patch)
treecf7f01a176329ae1b421b01319d97a835f0e9166 /src/script
parentd4166fa6ce24b55b483f29e8ef447c0f63f0a30f (diff)
downloadQt-2af7bc6259e41415817cadb456909f33249225ed.zip
Qt-2af7bc6259e41415817cadb456909f33249225ed.tar.gz
Qt-2af7bc6259e41415817cadb456909f33249225ed.tar.bz2
Add missing API shims to QScriptValue constructors
This is needed to ensure that the calls into JSC are safe, e.g. with regards to reentrancy. I was not able to construct a testcase, but several of our autotests crash without this change if COLLECT_ON_EVERY_ALLOCATION is set to 1 in Collector.cpp (this forces a garbage collection every time an object is allocated). Task-number: QTBUG-17815 Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/qscriptvalue.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index ac57918..e289636 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -254,6 +254,7 @@ QScriptValue::QScriptValue(QScriptEngine *engine, int val)
: d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine)))
{
if (engine) {
+ QScript::APIShim shim(d_ptr->engine);
JSC::ExecState *exec = d_ptr->engine->currentFrame;
d_ptr->initFrom(JSC::jsNumber(exec, val));
} else
@@ -271,6 +272,7 @@ QScriptValue::QScriptValue(QScriptEngine *engine, uint val)
: d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine)))
{
if (engine) {
+ QScript::APIShim shim(d_ptr->engine);
JSC::ExecState *exec = d_ptr->engine->currentFrame;
d_ptr->initFrom(JSC::jsNumber(exec, val));
} else
@@ -288,6 +290,7 @@ QScriptValue::QScriptValue(QScriptEngine *engine, qsreal val)
: d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine)))
{
if (engine) {
+ QScript::APIShim shim(d_ptr->engine);
JSC::ExecState *exec = d_ptr->engine->currentFrame;
d_ptr->initFrom(JSC::jsNumber(exec, val));
} else
@@ -305,6 +308,7 @@ QScriptValue::QScriptValue(QScriptEngine *engine, const QString &val)
: d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine)))
{
if (engine) {
+ QScript::APIShim shim(d_ptr->engine);
JSC::ExecState *exec = d_ptr->engine->currentFrame;
d_ptr->initFrom(JSC::jsString(exec, val));
} else {
@@ -325,6 +329,7 @@ QScriptValue::QScriptValue(QScriptEngine *engine, const char *val)
: d_ptr(new (QScriptEnginePrivate::get(engine))QScriptValuePrivate(QScriptEnginePrivate::get(engine)))
{
if (engine) {
+ QScript::APIShim shim(d_ptr->engine);
JSC::ExecState *exec = d_ptr->engine->currentFrame;
d_ptr->initFrom(JSC::jsString(exec, val));
} else {