History

first cut at shutting down scripts ahead of other cleanup

ZappoMan committed 11 years ago

Commit 0b607fa1 parent 70400f75 files · +268 −146Browse files

Showing the changes to interface/src/Application.cpp (1 of 5 files). Show all

Unified · Split

interface/src/Application.cpp+17−1
@@ -527,12 +527,22 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 526 unmodified lines
527527 }
528528
529529 void Application::aboutToQuit() {
530+qDebug() << "Application::aboutToQuit()";
530531 _aboutToQuit = true;
531532
532533 cleanupBeforeQuit();
533534 }
534535
535536 void Application::cleanupBeforeQuit() {
537+ qDebug() << "Application::cleanupBeforeQuit() ------------ START -----------------";
538+
539+ // stop entities running scripts
540+ _entities.shutdown();
541+
542+ // stop all running scripts
543+ ScriptEngine::gracefullyStopAllScripts();
544+
545+
536546 // first stop all timers directly or by invokeMethod
537547 // depending on what thread they run in
538548 locationUpdateTimer->stop();
@@ -572,6 +582,8 @@ void Application::cleanupBeforeQuit() { · 33 unmodified lines
572582
573583 // destroy the AudioClient so it and its thread have a chance to go down safely
574584 DependencyManager::destroy<AudioClient>();
585+
586+ qDebug() << "Application::cleanupBeforeQuit() ------------ DONE -----------------";
575587 }
576588
577589 Application::~Application() {
@@ -3432,6 +3444,7 @@ void Application::clearScriptsBeforeRunning() { · 2854 unmodified lines
34323444 }
34333445
34343446 void Application::saveScripts() {
3447+qDebug() << "Application::saveScripts()";
34353448 // Saves all currently running user-loaded scripts
34363449 Settings settings;
34373450 settings.beginWriteArray(SETTINGS_KEY);
@@ -3525,7 +3538,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 87 unmodified lines
35253538 #endif
35263539
35273540 QThread* workerThread = new QThread(this);
3528− workerThread->setObjectName("Script Engine Thread");
3541+ QString scriptEngineName = QString("Script Thread:") + scriptEngine->getFilename();
3542+ workerThread->setObjectName(scriptEngineName);
35293543
35303544 // when the worker thread is started, call our engine's run..
35313545 connect(workerThread, &QThread::started, scriptEngine, &ScriptEngine::run);
@@ -3599,6 +3613,7 @@ void Application::handleScriptLoadError(const QString& scriptFilename) { · 67 unmodified lines
35993613 }
36003614
36013615 void Application::scriptFinished(const QString& scriptName) {
3616+ qDebug() << "Application::scriptFinished(), scriptName:" << scriptName;
36023617 const QString& scriptURLString = QUrl(scriptName).toString();
36033618 QHash<QString, ScriptEngine*>::iterator it = _scriptEnginesHash.find(scriptURLString);
36043619 if (it != _scriptEnginesHash.end()) {
@@ -3609,6 +3624,7 @@ void Application::scriptFinished(const QString& scriptName) { · 4 unmodified lines
36093624 }
36103625
36113626 void Application::stopAllScripts(bool restart) {
3627+ qDebug() << "Application::stopAllScripts()... restart:" << restart;
36123628 // stops all current running scripts
36133629 for (QHash<QString, ScriptEngine*>::const_iterator it = _scriptEnginesHash.constBegin();
36143630 it != _scriptEnginesHash.constEnd(); it++) {

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