Showing the changes to libraries/script-engine/src/ScriptEngines.cpp (1 of 3 files). Show all
Unified · Split
| @@ -149,6 +149,7 @@ void ScriptEngines::shutdownScripting() { · 148 unmodified lines | |||
| 149 | // NOTE: typically all script engines are running. But there's at least one known exception to this, the | 149 | // NOTE: typically all script engines are running. But there's at least one known exception to this, the |
| 150 | // "entities sandbox" which is only used to evaluate entities scripts to test their validity before using | 150 | // "entities sandbox" which is only used to evaluate entities scripts to test their validity before using |
| 151 | // them. We don't need to stop scripts that aren't running. | 151 | // them. We don't need to stop scripts that aren't running. |
| 152 | // TODO: Scripts could be shut down faster if we spread them across a threadpool. | ||
| 152 | if (scriptEngine->isRunning()) { | 153 | if (scriptEngine->isRunning()) { |
| 153 | qCDebug(scriptengine) << "about to shutdown script:" << scriptName; | 154 | qCDebug(scriptengine) << "about to shutdown script:" << scriptName; |
| 154 | 155 | ||
| @@ -165,12 +166,12 @@ void ScriptEngines::shutdownScripting() { · 10 unmodified lines | |||
| 165 | // want any of the scripts final "scriptEnding()" or pending "update()" methods from accessing | 166 | // want any of the scripts final "scriptEnding()" or pending "update()" methods from accessing |
| 166 | // any application state after we leave this stopAllScripts() method | 167 | // any application state after we leave this stopAllScripts() method |
| 167 | qCDebug(scriptengine) << "waiting on script:" << scriptName; | 168 | qCDebug(scriptengine) << "waiting on script:" << scriptName; |
| 168 | scriptEngine->waitTillDoneRunning(); | 169 | scriptEngine->wait(); |
| 169 | qCDebug(scriptengine) << "done waiting on script:" << scriptName; | 170 | qCDebug(scriptengine) << "done waiting on script:" << scriptName; |
| 170 | 171 | ||
| 171 | scriptEngine->deleteLater(); | 172 | scriptEngine->deleteLater(); |
| 172 | 173 | ||
| 173 | // If the script is stopped, we can remove it from our set | 174 | // Once the script is stopped, we can remove it from our set |
| 174 | i.remove(); | 175 | i.remove(); |
| 175 | } | 176 | } |
| 176 | } | 177 | } |