History

Merge branch 'master' of github.com:highfidelity/hifi into fix/script-thread-dtor

Zach Pomerantz committed 10 years ago

Commit 7d4276d2 parents 61fbb70 06d1bd580 files · +1306 −780Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 80 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+7−9
@@ -62,8 +62,6 @@ · 61 unmodified lines
6262
6363 #include "MIDIEvent.h"
6464
65−std::atomic<bool> ScriptEngine::_stoppingAllScripts { false };
66−
6765 static const QString SCRIPT_EXCEPTION_FORMAT = "[UncaughtException] %1 in %2:%3";
6866
6967 Q_DECLARE_METATYPE(QScriptEngine::FunctionSignature)
@@ -762,7 +760,7 @@ void ScriptEngine::addEventHandler(const EntityItemID& entityID, const QString& · 692 unmodified lines
762760
763761
764762 QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fileName, int lineNumber) {
765− if (_stoppingAllScripts) {
763+ if (DependencyManager::get<ScriptEngines>()->isStopped()) {
766764 return QScriptValue(); // bail early
767765 }
768766
@@ -796,7 +794,7 @@ QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fi · 27 unmodified lines
796794 }
797795
798796 void ScriptEngine::run() {
799− if (_stoppingAllScripts) {
797+ if (DependencyManager::get<ScriptEngines>()->isStopped()) {
800798 return; // bail early - avoid setting state in init(), as evaluate() will bail too
801799 }
802800
@@ -1015,7 +1013,7 @@ QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int · 212 unmodified lines
10151013 }
10161014
10171015 QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) {
1018− if (_stoppingAllScripts) {
1016+ if (DependencyManager::get<ScriptEngines>()->isStopped()) {
10191017 qCDebug(scriptengine) << "Script.setInterval() while shutting down is ignored... parent script:" << getFilename();
10201018 return NULL; // bail early
10211019 }
@@ -1024,7 +1022,7 @@ QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) · 2 unmodified lines
10241022 }
10251023
10261024 QObject* ScriptEngine::setTimeout(const QScriptValue& function, int timeoutMS) {
1027− if (_stoppingAllScripts) {
1025+ if (DependencyManager::get<ScriptEngines>()->isStopped()) {
10281026 qCDebug(scriptengine) << "Script.setTimeout() while shutting down is ignored... parent script:" << getFilename();
10291027 return NULL; // bail early
10301028 }
@@ -1074,7 +1072,7 @@ void ScriptEngine::print(const QString& message) { · 43 unmodified lines
10741072 // If no callback is specified, the included files will be loaded synchronously and will block execution until
10751073 // all of the files have finished loading.
10761074 void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) {
1077− if (_stoppingAllScripts) {
1075+ if (DependencyManager::get<ScriptEngines>()->isStopped()) {
10781076 qCDebug(scriptengine) << "Script.include() while shutting down is ignored..."
10791077 << "includeFiles:" << includeFiles << "parent script:" << getFilename();
10801078 return; // bail early
@@ -1172,7 +1170,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac · 91 unmodified lines
11721170 }
11731171
11741172 void ScriptEngine::include(const QString& includeFile, QScriptValue callback) {
1175− if (_stoppingAllScripts) {
1173+ if (DependencyManager::get<ScriptEngines>()->isStopped()) {
11761174 qCDebug(scriptengine) << "Script.include() while shutting down is ignored... "
11771175 << "includeFile:" << includeFile << "parent script:" << getFilename();
11781176 return; // bail early
@@ -1187,7 +1185,7 @@ void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { · 8 unmodified lines
11871185 // as a stand-alone script. To accomplish this, the ScriptEngine class just emits a signal which
11881186 // the Application or other context will connect to in order to know to actually load the script
11891187 void ScriptEngine::load(const QString& loadFile) {
1190− if (_stoppingAllScripts) {
1188+ if (DependencyManager::get<ScriptEngines>()->isStopped()) {
11911189 qCDebug(scriptengine) << "Script.load() while shutting down is ignored... "
11921190 << "loadFile:" << loadFile << "parent script:" << getFilename();
11931191 return; // bail early