Showing the changes to interface/src/Application.cpp (1 of 5 files). Show all
Unified · Split
| @@ -527,12 +527,22 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 526 unmodified lines | |||
| 527 | } | 527 | } |
| 528 | 528 | ||
| 529 | void Application::aboutToQuit() { | 529 | void Application::aboutToQuit() { |
| 530 | qDebug() << "Application::aboutToQuit()"; | ||
| 530 | _aboutToQuit = true; | 531 | _aboutToQuit = true; |
| 531 | 532 | ||
| 532 | cleanupBeforeQuit(); | 533 | cleanupBeforeQuit(); |
| 533 | } | 534 | } |
| 534 | 535 | ||
| 535 | void Application::cleanupBeforeQuit() { | 536 | 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 | |||
| 536 | // first stop all timers directly or by invokeMethod | 546 | // first stop all timers directly or by invokeMethod |
| 537 | // depending on what thread they run in | 547 | // depending on what thread they run in |
| 538 | locationUpdateTimer->stop(); | 548 | locationUpdateTimer->stop(); |
| @@ -572,6 +582,8 @@ void Application::cleanupBeforeQuit() { · 33 unmodified lines | |||
| 572 | 582 | ||
| 573 | // destroy the AudioClient so it and its thread have a chance to go down safely | 583 | // destroy the AudioClient so it and its thread have a chance to go down safely |
| 574 | DependencyManager::destroy<AudioClient>(); | 584 | DependencyManager::destroy<AudioClient>(); |
| 585 | |||
| 586 | qDebug() << "Application::cleanupBeforeQuit() ------------ DONE -----------------"; | ||
| 575 | } | 587 | } |
| 576 | 588 | ||
| 577 | Application::~Application() { | 589 | Application::~Application() { |
| @@ -3432,6 +3444,7 @@ void Application::clearScriptsBeforeRunning() { · 2854 unmodified lines | |||
| 3432 | } | 3444 | } |
| 3433 | 3445 | ||
| 3434 | void Application::saveScripts() { | 3446 | void Application::saveScripts() { |
| 3447 | qDebug() << "Application::saveScripts()"; | ||
| 3435 | // Saves all currently running user-loaded scripts | 3448 | // Saves all currently running user-loaded scripts |
| 3436 | Settings settings; | 3449 | Settings settings; |
| 3437 | settings.beginWriteArray(SETTINGS_KEY); | 3450 | settings.beginWriteArray(SETTINGS_KEY); |
| @@ -3525,7 +3538,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri · 87 unmodified lines | |||
| 3525 | #endif | 3538 | #endif |
| 3526 | 3539 | ||
| 3527 | QThread* workerThread = new QThread(this); | 3540 | QThread* workerThread = new QThread(this); |
| 3528 | workerThread->setObjectName("Script Engine Thread"); | 3541 | QString scriptEngineName = QString("Script Thread:") + scriptEngine->getFilename(); |
| 3542 | workerThread->setObjectName(scriptEngineName); | ||
| 3529 | 3543 | ||
| 3530 | // when the worker thread is started, call our engine's run.. | 3544 | // when the worker thread is started, call our engine's run.. |
| 3531 | connect(workerThread, &QThread::started, scriptEngine, &ScriptEngine::run); | 3545 | connect(workerThread, &QThread::started, scriptEngine, &ScriptEngine::run); |
| @@ -3599,6 +3613,7 @@ void Application::handleScriptLoadError(const QString& scriptFilename) { · 67 unmodified lines | |||
| 3599 | } | 3613 | } |
| 3600 | 3614 | ||
| 3601 | void Application::scriptFinished(const QString& scriptName) { | 3615 | void Application::scriptFinished(const QString& scriptName) { |
| 3616 | qDebug() << "Application::scriptFinished(), scriptName:" << scriptName; | ||
| 3602 | const QString& scriptURLString = QUrl(scriptName).toString(); | 3617 | const QString& scriptURLString = QUrl(scriptName).toString(); |
| 3603 | QHash<QString, ScriptEngine*>::iterator it = _scriptEnginesHash.find(scriptURLString); | 3618 | QHash<QString, ScriptEngine*>::iterator it = _scriptEnginesHash.find(scriptURLString); |
| 3604 | if (it != _scriptEnginesHash.end()) { | 3619 | if (it != _scriptEnginesHash.end()) { |
| @@ -3609,6 +3624,7 @@ void Application::scriptFinished(const QString& scriptName) { · 4 unmodified lines | |||
| 3609 | } | 3624 | } |
| 3610 | 3625 | ||
| 3611 | void Application::stopAllScripts(bool restart) { | 3626 | void Application::stopAllScripts(bool restart) { |
| 3627 | qDebug() << "Application::stopAllScripts()... restart:" << restart; | ||
| 3612 | // stops all current running scripts | 3628 | // stops all current running scripts |
| 3613 | for (QHash<QString, ScriptEngine*>::const_iterator it = _scriptEnginesHash.constBegin(); | 3629 | for (QHash<QString, ScriptEngine*>::const_iterator it = _scriptEnginesHash.constBegin(); |
| 3614 | it != _scriptEnginesHash.constEnd(); it++) { | 3630 | it != _scriptEnginesHash.constEnd(); it++) { |