diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-08-25 00:35:35 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-08-25 00:35:35 (GMT) |
commit | 8e580cebef7128666017ba39d41aa620a1d2eddf (patch) | |
tree | 77a920fcb1782f90021a5f80d8b5c31b0ddd1256 /src/declarative/qml/qmlexpression.cpp | |
parent | 6d57d71824ba67cfed07bcb27ab62349ee7d4c6e (diff) | |
download | Qt-8e580cebef7128666017ba39d41aa620a1d2eddf.zip Qt-8e580cebef7128666017ba39d41aa620a1d2eddf.tar.gz Qt-8e580cebef7128666017ba39d41aa620a1d2eddf.tar.bz2 |
Only need to mess with the scope chain when evaluating.
Diffstat (limited to 'src/declarative/qml/qmlexpression.cpp')
-rw-r--r-- | src/declarative/qml/qmlexpression.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index 00454a1..77463cd 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -225,12 +225,13 @@ QVariant QmlExpressionPrivate::evalQtScript() ctxtPriv->defaultObjects.insert(ctxtPriv->highPriorityCount, me); QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); - QScriptContext *scriptContext = scriptEngine->pushContext(); - for (int i = ctxtPriv->scopeChain.size() - 1; i > -1; --i) - scriptContext->pushScope(ctxtPriv->scopeChain.at(i)); if (!expressionFunctionValid) { + QScriptContext *scriptContext = scriptEngine->pushContext(); + for (int i = ctxtPriv->scopeChain.size() - 1; i > -1; --i) + scriptContext->pushScope(ctxtPriv->scopeChain.at(i)); + if (expressionRewritten) { expressionFunction = scriptEngine->evaluate(expression, fileName, line); } else { @@ -239,12 +240,13 @@ QVariant QmlExpressionPrivate::evalQtScript() const QString code = rewriteBinding(expression); expressionFunction = scriptEngine->evaluate(code, fileName, line); } + + scriptEngine->popContext(); expressionFunctionValid = true; } QScriptValue svalue = expressionFunction.call(); - if (scriptEngine->hasUncaughtException()) { if (scriptEngine->uncaughtException().isError()){ QScriptValue exception = scriptEngine->uncaughtException(); @@ -301,8 +303,6 @@ QVariant QmlExpressionPrivate::evalQtScript() if (rv.isNull()) rv = svalue.toVariant(); - scriptEngine->popContext(); - return rv; } |