Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 80 files). Show all
Unified · Split
| @@ -62,8 +62,6 @@ · 61 unmodified lines | ||
| 62 | 62 | |
| 63 | 63 | #include "MIDIEvent.h" |
| 64 | 64 | |
| 65 | −std::atomic<bool> ScriptEngine::_stoppingAllScripts { false }; | |
| 66 | − | |
| 67 | 65 | static const QString SCRIPT_EXCEPTION_FORMAT = "[UncaughtException] %1 in %2:%3"; |
| 68 | 66 | |
| 69 | 67 | Q_DECLARE_METATYPE(QScriptEngine::FunctionSignature) |
| @@ -762,7 +760,7 @@ void ScriptEngine::addEventHandler(const EntityItemID& entityID, const QString& · 692 unmodified lines | ||
| 762 | 760 | |
| 763 | 761 | |
| 764 | 762 | QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fileName, int lineNumber) { |
| 765 | − if (_stoppingAllScripts) { | |
| 763 | + if (DependencyManager::get<ScriptEngines>()->isStopped()) { | |
| 766 | 764 | return QScriptValue(); // bail early |
| 767 | 765 | } |
| 768 | 766 | |
| @@ -796,7 +794,7 @@ QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fi · 27 unmodified lines | ||
| 796 | 794 | } |
| 797 | 795 | |
| 798 | 796 | void ScriptEngine::run() { |
| 799 | − if (_stoppingAllScripts) { | |
| 797 | + if (DependencyManager::get<ScriptEngines>()->isStopped()) { | |
| 800 | 798 | return; // bail early - avoid setting state in init(), as evaluate() will bail too |
| 801 | 799 | } |
| 802 | 800 | |
| @@ -1015,7 +1013,7 @@ QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int · 212 unmodified lines | ||
| 1015 | 1013 | } |
| 1016 | 1014 | |
| 1017 | 1015 | QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) { |
| 1018 | − if (_stoppingAllScripts) { | |
| 1016 | + if (DependencyManager::get<ScriptEngines>()->isStopped()) { | |
| 1019 | 1017 | qCDebug(scriptengine) << "Script.setInterval() while shutting down is ignored... parent script:" << getFilename(); |
| 1020 | 1018 | return NULL; // bail early |
| 1021 | 1019 | } |
| @@ -1024,7 +1022,7 @@ QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) · 2 unmodified lines | ||
| 1024 | 1022 | } |
| 1025 | 1023 | |
| 1026 | 1024 | QObject* ScriptEngine::setTimeout(const QScriptValue& function, int timeoutMS) { |
| 1027 | − if (_stoppingAllScripts) { | |
| 1025 | + if (DependencyManager::get<ScriptEngines>()->isStopped()) { | |
| 1028 | 1026 | qCDebug(scriptengine) << "Script.setTimeout() while shutting down is ignored... parent script:" << getFilename(); |
| 1029 | 1027 | return NULL; // bail early |
| 1030 | 1028 | } |
| @@ -1074,7 +1072,7 @@ void ScriptEngine::print(const QString& message) { · 43 unmodified lines | ||
| 1074 | 1072 | // If no callback is specified, the included files will be loaded synchronously and will block execution until |
| 1075 | 1073 | // all of the files have finished loading. |
| 1076 | 1074 | void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) { |
| 1077 | − if (_stoppingAllScripts) { | |
| 1075 | + if (DependencyManager::get<ScriptEngines>()->isStopped()) { | |
| 1078 | 1076 | qCDebug(scriptengine) << "Script.include() while shutting down is ignored..." |
| 1079 | 1077 | << "includeFiles:" << includeFiles << "parent script:" << getFilename(); |
| 1080 | 1078 | return; // bail early |
| @@ -1172,7 +1170,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac · 91 unmodified lines | ||
| 1172 | 1170 | } |
| 1173 | 1171 | |
| 1174 | 1172 | void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { |
| 1175 | − if (_stoppingAllScripts) { | |
| 1173 | + if (DependencyManager::get<ScriptEngines>()->isStopped()) { | |
| 1176 | 1174 | qCDebug(scriptengine) << "Script.include() while shutting down is ignored... " |
| 1177 | 1175 | << "includeFile:" << includeFile << "parent script:" << getFilename(); |
| 1178 | 1176 | return; // bail early |
| @@ -1187,7 +1185,7 @@ void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { · 8 unmodified lines | ||
| 1187 | 1185 | // as a stand-alone script. To accomplish this, the ScriptEngine class just emits a signal which |
| 1188 | 1186 | // the Application or other context will connect to in order to know to actually load the script |
| 1189 | 1187 | void ScriptEngine::load(const QString& loadFile) { |
| 1190 | − if (_stoppingAllScripts) { | |
| 1188 | + if (DependencyManager::get<ScriptEngines>()->isStopped()) { | |
| 1191 | 1189 | qCDebug(scriptengine) << "Script.load() while shutting down is ignored... " |
| 1192 | 1190 | << "loadFile:" << loadFile << "parent script:" << getFilename(); |
| 1193 | 1191 | return; // bail early |