History

Hide script stop behind accessor and fix friendship

Zach Pomerantz committed 10 years ago

Commit 36565591 parent 59e4b9c4 files · +19 −13Browse files

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

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+7−7
@@ -754,7 +754,7 @@ void ScriptEngine::addEventHandler(const EntityItemID& entityID, const QString& · 753 unmodified lines
754 754
755 755
756QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fileName, int lineNumber) {756QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fileName, int lineNumber) {
757 if (DependencyManager::get<ScriptEngines>()->_stopped) {757 if (DependencyManager::get<ScriptEngines>()->isStopped()) {
758 return QScriptValue(); // bail early758 return QScriptValue(); // bail early
759 }759 }
760 760
@@ -790,7 +790,7 @@ QScriptValue ScriptEngine::evaluate(const QString& sourceCode, const QString& fi · 29 unmodified lines
790}790}
791 791
792void ScriptEngine::run() {792void ScriptEngine::run() {
793 if (DependencyManager::get<ScriptEngines>()->_stopped) {793 if (DependencyManager::get<ScriptEngines>()->isStopped()) {
794 return; // bail early - avoid setting state in init(), as evaluate() will bail too794 return; // bail early - avoid setting state in init(), as evaluate() will bail too
795 }795 }
796 796
@@ -1023,7 +1023,7 @@ QObject* ScriptEngine::setupTimerWithInterval(const QScriptValue& function, int · 226 unmodified lines
1023}1023}
1024 1024
1025QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) {1025QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) {
1026 if (DependencyManager::get<ScriptEngines>()->_stopped) {1026 if (DependencyManager::get<ScriptEngines>()->isStopped()) {
1027 qCDebug(scriptengine) << "Script.setInterval() while shutting down is ignored... parent script:" << getFilename();1027 qCDebug(scriptengine) << "Script.setInterval() while shutting down is ignored... parent script:" << getFilename();
1028 return NULL; // bail early1028 return NULL; // bail early
1029 }1029 }
@@ -1032,7 +1032,7 @@ QObject* ScriptEngine::setInterval(const QScriptValue& function, int intervalMS) · 2 unmodified lines
1032}1032}
1033 1033
1034QObject* ScriptEngine::setTimeout(const QScriptValue& function, int timeoutMS) {1034QObject* ScriptEngine::setTimeout(const QScriptValue& function, int timeoutMS) {
1035 if (DependencyManager::get<ScriptEngines>()->_stopped) {1035 if (DependencyManager::get<ScriptEngines>()->isStopped()) {
1036 qCDebug(scriptengine) << "Script.setTimeout() while shutting down is ignored... parent script:" << getFilename();1036 qCDebug(scriptengine) << "Script.setTimeout() while shutting down is ignored... parent script:" << getFilename();
1037 return NULL; // bail early1037 return NULL; // bail early
1038 }1038 }
@@ -1084,7 +1084,7 @@ void ScriptEngine::print(const QString& message) { · 45 unmodified lines
1084// If no callback is specified, the included files will be loaded synchronously and will block execution until1084// If no callback is specified, the included files will be loaded synchronously and will block execution until
1085// all of the files have finished loading.1085// all of the files have finished loading.
1086void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) {1086void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callback) {
1087 if (DependencyManager::get<ScriptEngines>()->_stopped) {1087 if (DependencyManager::get<ScriptEngines>()->isStopped()) {
1088 qCDebug(scriptengine) << "Script.include() while shutting down is ignored..."1088 qCDebug(scriptengine) << "Script.include() while shutting down is ignored..."
1089 << "includeFiles:" << includeFiles << "parent script:" << getFilename();1089 << "includeFiles:" << includeFiles << "parent script:" << getFilename();
1090 return; // bail early1090 return; // bail early
@@ -1182,7 +1182,7 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac · 91 unmodified lines
1182}1182}
1183 1183
1184void ScriptEngine::include(const QString& includeFile, QScriptValue callback) {1184void ScriptEngine::include(const QString& includeFile, QScriptValue callback) {
1185 if (DependencyManager::get<ScriptEngines>()->_stopped) {1185 if (DependencyManager::get<ScriptEngines>()->isStopped()) {
1186 qCDebug(scriptengine) << "Script.include() while shutting down is ignored... "1186 qCDebug(scriptengine) << "Script.include() while shutting down is ignored... "
1187 << "includeFile:" << includeFile << "parent script:" << getFilename();1187 << "includeFile:" << includeFile << "parent script:" << getFilename();
1188 return; // bail early1188 return; // bail early
@@ -1197,7 +1197,7 @@ void ScriptEngine::include(const QString& includeFile, QScriptValue callback) { · 8 unmodified lines
1197// as a stand-alone script. To accomplish this, the ScriptEngine class just emits a signal which1197// as a stand-alone script. To accomplish this, the ScriptEngine class just emits a signal which
1198// the Application or other context will connect to in order to know to actually load the script1198// the Application or other context will connect to in order to know to actually load the script
1199void ScriptEngine::load(const QString& loadFile) {1199void ScriptEngine::load(const QString& loadFile) {
1200 if (DependencyManager::get<ScriptEngines>()->_stopped) {1200 if (DependencyManager::get<ScriptEngines>()->isStopped()) {
1201 qCDebug(scriptengine) << "Script.load() while shutting down is ignored... "1201 qCDebug(scriptengine) << "Script.load() while shutting down is ignored... "
1202 << "loadFile:" << loadFile << "parent script:" << getFilename();1202 << "loadFile:" << loadFile << "parent script:" << getFilename();
1203 return; // bail early1203 return; // bail early

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t