diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-03-19 15:13:08 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-03-19 16:34:46 (GMT) |
commit | 04d4cbeb36f75661aca06f93066a8603afd96f76 (patch) | |
tree | d24dba77d4a0bf9a2086201b9a453c2beea22e45 /src/script | |
parent | 0dddbc0c22e41f85d0426d3a4d83d890198d6789 (diff) | |
download | Qt-04d4cbeb36f75661aca06f93066a8603afd96f76.zip Qt-04d4cbeb36f75661aca06f93066a8603afd96f76.tar.gz Qt-04d4cbeb36f75661aca06f93066a8603afd96f76.tar.bz2 |
QScriptClass-implemented constructors lead to application crash
Add missing popContext() to balance the pushContext().
Task-number: QTBUG-8364
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/bridge/qscriptclassobject.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp index a3dd239..a4d9cc1 100644 --- a/src/script/bridge/qscriptclassobject.cpp +++ b/src/script/bridge/qscriptclassobject.cpp @@ -226,7 +226,7 @@ JSC::JSObject* ClassObjectDelegate::construct(JSC::ExecState *exec, JSC::JSObjec QScriptClass *scriptClass = static_cast<ClassObjectDelegate*>(delegate)->scriptClass(); QScriptEnginePrivate *eng_p = scriptEngineFromExec(exec); - //JSC::ExecState *oldFrame = eng_p->currentFrame; + JSC::ExecState *oldFrame = eng_p->currentFrame; eng_p->pushContext(exec, JSC::JSValue(), args, callee, true); QScriptContext *ctx = eng_p->contextForFrame(eng_p->currentFrame); @@ -234,6 +234,8 @@ JSC::JSObject* ClassObjectDelegate::construct(JSC::ExecState *exec, JSC::JSObjec QScriptValue result = qvariant_cast<QScriptValue>(scriptClass->extension(QScriptClass::Callable, qVariantFromValue(ctx))); if (!result.isObject()) result = defaultObject; + eng_p->popContext(); + eng_p->currentFrame = oldFrame; return JSC::asObject(eng_p->scriptValueToJSCValue(result)); } |