diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-03-26 13:00:02 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-03-26 15:16:49 (GMT) |
commit | 7a11acd536d84ad22ef98a0fdbdb4322a55efafb (patch) | |
tree | dd36701a69219ec43182001a61386c99b6644e7d /src/script/bridge | |
parent | 61b488a965eebc52104243dce21eaeb203cfecae (diff) | |
download | Qt-7a11acd536d84ad22ef98a0fdbdb4322a55efafb.zip Qt-7a11acd536d84ad22ef98a0fdbdb4322a55efafb.tar.gz Qt-7a11acd536d84ad22ef98a0fdbdb4322a55efafb.tar.bz2 |
QtScript: Add yet more missing API shims
- for QScriptEngine and QScriptContext; we don't control what the
JSC functions are doing, so it's better to have shims than not to
have them (which can cause something to blow up), even if they
might not be strictly necessary as of this writing.
- for QScriptDeclarativeClass; otherwise the identifiers might
be created/destroyed in the wrong engine.
- for QScriptValueIterator destructor; otherwise the identifiers
might be destroyed in the wrong engine.
This is an attempt to fix a crash in Bauhaus, but it might still
be crashing (i.e. still some shims missing, somewhere) ;(
Diffstat (limited to 'src/script/bridge')
-rw-r--r-- | src/script/bridge/qscriptdeclarativeclass.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp index acfb2a4..c72eb94 100644 --- a/src/script/bridge/qscriptdeclarativeclass.cpp +++ b/src/script/bridge/qscriptdeclarativeclass.cpp @@ -148,9 +148,12 @@ QScriptDeclarativeClass::PersistentIdentifier::PersistentIdentifier() QScriptDeclarativeClass::PersistentIdentifier::~PersistentIdentifier() { - if (engine) - JSC::setCurrentIdentifierTable(engine->globalData->identifierTable); - ((JSC::Identifier &)d).JSC::Identifier::~Identifier(); + if (engine) { + QScript::APIShim shim(engine); + ((JSC::Identifier &)d).JSC::Identifier::~Identifier(); + } else { + ((JSC::Identifier &)d).JSC::Identifier::~Identifier(); + } } QScriptDeclarativeClass::PersistentIdentifier::PersistentIdentifier(const PersistentIdentifier &other) @@ -184,7 +187,8 @@ QScriptValue QScriptDeclarativeClass::newObject(QScriptEngine *engine, Q_ASSERT(engine); Q_ASSERT(scriptClass); - QScriptEnginePrivate *p = static_cast<QScriptEnginePrivate *>(QObjectPrivate::get(engine)); + QScriptEnginePrivate *p = static_cast<QScriptEnginePrivate *>(QObjectPrivate::get(engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; QScriptObject *result = new (exec) QScriptObject(p->scriptObjectStructure); @@ -201,6 +205,7 @@ QScriptDeclarativeClass::newObjectValue(QScriptEngine *engine, Q_ASSERT(scriptClass); QScriptEnginePrivate *p = static_cast<QScriptEnginePrivate *>(QObjectPrivate::get(engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; QScriptObject *result = new (exec) QScriptObject(p->scriptObjectStructure); @@ -231,6 +236,7 @@ QScriptValue QScriptDeclarativeClass::function(const QScriptValue &v, const Iden if (!d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object)); @@ -254,6 +260,7 @@ QScriptValue QScriptDeclarativeClass::property(const QScriptValue &v, const Iden if (!d->isObject()) return QScriptValue(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object)); @@ -277,6 +284,7 @@ QScriptDeclarativeClass::functionValue(const QScriptValue &v, const Identifier & if (!d->isObject()) return Value(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object)); @@ -301,6 +309,7 @@ QScriptDeclarativeClass::propertyValue(const QScriptValue &v, const Identifier & if (!d->isObject()) return Value(); + QScript::APIShim shim(d->engine); JSC::ExecState *exec = d->engine->currentFrame; JSC::JSObject *object = d->jscValue.getObject(); JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object)); @@ -326,6 +335,7 @@ QScriptValue QScriptDeclarativeClass::scopeChainValue(QScriptContext *context, i context->activationObject(); //ensure the creation of the normal scope for native context const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(context); QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame); + QScript::APIShim shim(engine); JSC::ScopeChainNode *node = frame->scopeChain(); JSC::ScopeChainIterator it(node); @@ -386,6 +396,7 @@ QScriptContext * QScriptDeclarativeClass::pushCleanContext(QScriptEngine *engine return 0; QScriptEnginePrivate *d = QScriptEnginePrivate::get(engine); + QScript::APIShim shim(d); JSC::CallFrame* newFrame = d->pushContext(d->currentFrame, d->currentFrame->globalData().dynamicGlobalObject, @@ -421,6 +432,7 @@ QScriptDeclarativeClass::createPersistentIdentifier(const QString &str) { QScriptEnginePrivate *p = static_cast<QScriptEnginePrivate *>(QObjectPrivate::get(d_ptr->engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; PersistentIdentifier rv(p); @@ -434,6 +446,7 @@ QScriptDeclarativeClass::createPersistentIdentifier(const Identifier &id) { QScriptEnginePrivate *p = static_cast<QScriptEnginePrivate *>(QObjectPrivate::get(d_ptr->engine)); + QScript::APIShim shim(p); JSC::ExecState* exec = p->currentFrame; PersistentIdentifier rv(p); |