summaryrefslogtreecommitdiffstats
path: root/src/script/bridge
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-09-22 14:56:37 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-09-22 14:59:39 (GMT)
commit77b1f0ab8c8055835a3fc92d784d536efdc6acbf (patch)
treee844d05c320702802f5fd6b041d6085054c9d560 /src/script/bridge
parent5c3c0d477104f6f4eafaceeacac8278c4b97f8cc (diff)
downloadQt-77b1f0ab8c8055835a3fc92d784d536efdc6acbf.zip
Qt-77b1f0ab8c8055835a3fc92d784d536efdc6acbf.tar.gz
Qt-77b1f0ab8c8055835a3fc92d784d536efdc6acbf.tar.bz2
make sure the engine's currentFrame is in sync when calling out to public API
The currentFrame pointer is used e.g. by QScriptValue::toString(). It needs to be in sync, otherwise we will crash. Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script/bridge')
-rw-r--r--src/script/bridge/qscriptclassobject.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index a5dc670..b57909f 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -90,12 +90,13 @@ bool ClassObjectDelegate::getOwnPropertySlot(QScriptObject* object,
const JSC::Identifier &propertyName,
JSC::PropertySlot &slot)
{
+ QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(engine, exec);
// for compatibility with the old back-end, normal JS properties
// are queried first.
if (QScriptObjectDelegate::getOwnPropertySlot(object, exec, propertyName, slot))
return true;
- QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
QScriptString scriptName;
QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
@@ -116,6 +117,7 @@ void ClassObjectDelegate::put(QScriptObject* object, JSC::ExecState *exec,
JSC::JSValue value, JSC::PutPropertySlot &slot)
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
QScriptString scriptName;
QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
@@ -136,6 +138,7 @@ bool ClassObjectDelegate::deleteProperty(QScriptObject* object, JSC::ExecState *
{
// ### avoid duplication of put()
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
QScriptString scriptName;
QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
@@ -157,6 +160,7 @@ bool ClassObjectDelegate::getPropertyAttributes(const QScriptObject* object, JSC
unsigned &attribs) const
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
QScriptString scriptName;
QScriptStringPrivate scriptName_d(engine, propertyName, QScriptStringPrivate::StackAllocated);
@@ -188,6 +192,7 @@ void ClassObjectDelegate::getPropertyNames(QScriptObject* object, JSC::ExecState
unsigned listedAttributes)
{
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
QScriptClassPropertyIterator *it = m_scriptClass->newIterator(scriptObject);
if (it != 0) {
@@ -267,6 +272,7 @@ bool ClassObjectDelegate::hasInstance(QScriptObject* object, JSC::ExecState *exe
return QScriptObjectDelegate::hasInstance(object, exec, value, proto);
QScriptValueList args;
QScriptEnginePrivate *eng_p = scriptEngineFromExec(exec);
+ QScript::SaveFrameHelper saveFrame(eng_p, exec);
args << eng_p->scriptValueFromJSCValue(object) << eng_p->scriptValueFromJSCValue(value);
QVariant result = scriptClass()->extension(QScriptClass::HasInstance, qVariantFromValue(args));
return result.toBool();