mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 19:16:56 +02:00
Bail early from ScriptEngine::run if stopped
evaluate() bails anyway, so this will avoid the cost of init(). If run() is invoked from runInThread(), this may avoid a race where _isRunning is set after it is checked because the check occured during init().
This commit is contained in:
parent
27551b8532
commit
6bf9a4518a
1 changed files with 5 additions and 4 deletions
|
@ -646,13 +646,14 @@ QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fi
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEngine::run() {
|
void ScriptEngine::run() {
|
||||||
// TODO: can we add a short circuit for _stoppingAllScripts here? What does it mean to not start running if
|
if (_stoppingAllScripts) {
|
||||||
// we're in the process of stopping?
|
return; // bail early - avoid setting state in init(), as evaluate() will bail too
|
||||||
|
}
|
||||||
|
|
||||||
if (!_isInitialized) {
|
if (!_isInitialized) {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
_isFinished = false;
|
_isFinished = false;
|
||||||
if (_wantSignals) {
|
if (_wantSignals) {
|
||||||
|
|
Loading…
Reference in a new issue