Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 4 files). Show all
Unified · Split
| @@ -52,8 +52,6 @@ · 51 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | #include "MIDIEvent.h" |
| 54 | 54 | |
| 55 | −std::atomic<bool> ScriptEngine::_stoppingAllScripts { false }; | |
| 56 | − | |
| 57 | 55 | static const QString SCRIPT_EXCEPTION_FORMAT = "[UncaughtException] %1 in %2:%3"; |
| 58 | 56 | |
| 59 | 57 | Q_DECLARE_METATYPE(QScriptEngine::FunctionSignature) |
| @@ -655,7 +653,7 @@ void ScriptEngine::addEventHandler(const EntityItemID& entityID, const QString& · 595 unmodified lines | ||
| 655 | 653 | |
| 656 | 654 | |
| 657 | 655 | QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fileName, int lineNumber) { |
| 658 | − if (_stoppingAllScripts) { | |
| 656 | + if (DependencyManager::get<ScriptEngines>()->_stopped) { | |
| 659 | 657 | return QScriptValue(); // bail early |
| 660 | 658 | } |
| 661 | 659 | |
| @@ -691,7 +689,7 @@ QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fi · 29 unmodified lines | ||
| 691 | 689 | } |
| 692 | 690 | |
| 693 | 691 | void ScriptEngine::run() { |
| 694 | − if (_stoppingAllScripts) { | |
| 692 | + if (DependencyManager::get<ScriptEngines>()->_stopped) { | |
| 695 | 693 | return; // bail early - avoid setting state in init(), as evaluate() will bail too |
| 696 | 694 | } |
| 697 | 695 | |
| @@ -901,7 +899,7 @@ QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int · 203 unmodified lines | ||
| 901 | 899 | } |
| 902 | 900 | |
| 903 | 901 | QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) { |
| 904 | − if (_stoppingAllScripts) { | |
| 902 | + if (DependencyManager::get<ScriptEngines>()->_stopped) { | |
| 905 | 903 | qCDebug(scriptengine) << "Script.setInterval() while shutting down is ignored... parent script:" << getFilename(); |
| 906 | 904 | return NULL; // bail early |
| 907 | 905 | } |
| @@ -910,7 +908,7 @@ QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) · 2 unmodified lines | ||
| 910 | 908 | } |
| 911 | 909 | |
| 912 | 910 | QObject* ScriptEngine::setTimeout(const QScriptValue& function, int timeoutMS) { |
| 913 | − if (_stoppingAllScripts) { | |
| 911 | + if (DependencyManager::get<ScriptEngines>()->_stopped) { | |
| 914 | 912 | qCDebug(scriptengine) << "Script.setTimeout() while shutting down is ignored... parent script:" << getFilename(); |
| 915 | 913 | return NULL; // bail early |
| 916 | 914 | } |
| @@ -962,7 +960,7 @@ void ScriptEngine::print(const QString& message) { · 45 unmodified lines | ||
| 962 | 960 | // If no callback is specified, the included files will be loaded synchronously and will block execution until |
| 963 | 961 | // all of the files have finished loading. |
| 964 | 962 | void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) { |
| 965 | − if (_stoppingAllScripts) { | |
| 963 | + if (DependencyManager::get<ScriptEngines>()->_stopped) { | |
| 966 | 964 | qCDebug(scriptengine) << "Script.include() while shutting down is ignored..." |
| 967 | 965 | << "includeFiles:" << includeFiles << "parent script:" << getFilename(); |
| 968 | 966 | return; // bail early |
| @@ -1063,7 +1061,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac · 94 unmodified lines | ||
| 1063 | 1061 | } |
| 1064 | 1062 | |
| 1065 | 1063 | void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { |
| 1066 | − if (_stoppingAllScripts) { | |
| 1064 | + if (DependencyManager::get<ScriptEngines>()->_stopped) { | |
| 1067 | 1065 | qCDebug(scriptengine) << "Script.include() while shutting down is ignored... " |
| 1068 | 1066 | << "includeFile:" << includeFile << "parent script:" << getFilename(); |
| 1069 | 1067 | return; // bail early |
| @@ -1078,7 +1076,7 @@ void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { · 8 unmodified lines | ||
| 1078 | 1076 | // as a stand-alone script. To accomplish this, the ScriptEngine class just emits a signal which |
| 1079 | 1077 | // the Application or other context will connect to in order to know to actually load the script |
| 1080 | 1078 | void ScriptEngine::load(const QString& loadFile) { |
| 1081 | − if (_stoppingAllScripts) { | |
| 1079 | + if (DependencyManager::get<ScriptEngines>()->_stopped) { | |
| 1082 | 1080 | qCDebug(scriptengine) << "Script.load() while shutting down is ignored... " |
| 1083 | 1081 | << "loadFile:" << loadFile << "parent script:" << getFilename(); |
| 1084 | 1082 | return; // bail early |