summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/script/api/qscriptengine.cpp22
-rw-r--r--src/script/api/qscriptengine_p.h1
2 files changed, 21 insertions, 2 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 261efce..5ef07b9 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -788,9 +788,26 @@ static QScriptValue __setupPackage__(QScriptContext *ctx, QScriptEngine *eng)
}
#endif
+// Helper class for stacking a script engine's inEval attribute.
+class InEval
+{
+public:
+ inline InEval(QScriptEnginePrivate *e)
+ : engine(e), was(e->inEval)
+ {
+ e->inEval = true;
+ }
+ inline ~InEval()
+ { engine->inEval = was; }
+private:
+ QScriptEnginePrivate *engine;
+ bool was;
+};
+
} // namespace QScript
-QScriptEnginePrivate::QScriptEnginePrivate() : idGenerator(1)
+QScriptEnginePrivate::QScriptEnginePrivate()
+ : inEval(false), idGenerator(1)
{
qMetaTypeId<QScriptValue>();
@@ -2154,6 +2171,7 @@ QScriptValue QScriptEngine::evaluate(const QString &program, const QString &file
Q_D(QScriptEngine);
JSC::JSLock lock(false); // ### hmmm
+ QScript::InEval inEval(d);
currentContext()->activationObject(); //force the creation of a context for native function;
JSC::UString jscProgram = program;
@@ -3501,7 +3519,7 @@ int QScriptEngine::processEventsInterval() const
bool QScriptEngine::isEvaluating() const
{
Q_D(const QScriptEngine);
- return (d->currentFrame != d->globalExec());
+ return (d->currentFrame != d->globalExec()) || d->inEval;
}
/*!
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index 3a5c79d..bc1dc92 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -243,6 +243,7 @@ public:
QHash<int, QScriptTypeInfo*> m_typeInfos;
int processEventsInterval;
QScriptValue abortResult;
+ bool inEval;
QSet<QString> importedExtensions;
QSet<QString> extensionsBeingImported;