Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 4 files). Show all
Unified · Split
| @@ -451,7 +451,7 @@ void ScriptEngine::executeOnScriptThread(std::function<void()> function, const Q · 450 unmodified lines | |||
| 451 | function(); | 451 | function(); |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | void ScriptEngine::waitTillDoneRunning() { | 454 | void ScriptEngine::waitTillDoneRunning(bool shutdown) { |
| 455 | // Engine should be stopped already, but be defensive | 455 | // Engine should be stopped already, but be defensive |
| 456 | stop(); | 456 | stop(); |
| 457 | 457 | ||
| @@ -520,12 +520,14 @@ void ScriptEngine::waitTillDoneRunning() { · 62 unmodified lines | |||
| 520 | } | 520 | } |
| 521 | } | 521 | } |
| 522 | 522 | ||
| 523 | // NOTE: This will be called on the main application thread (among other threads) from stopAllScripts. | 523 | if (shutdown) { |
| 524 | // The thread will need to continue to process events, because | 524 | // NOTE: This will be called on the main application thread (among other threads) from stopAllScripts. |
| 525 | // the scripts will likely need to marshall messages across to the main thread, e.g. | 525 | // The thread will need to continue to process events, because |
| 526 | // if they access Settings or Menu in any of their shutdown code. So: | 526 | // the scripts will likely need to marshall messages across to the main thread, e.g. |
| 527 | // Process events for this thread, allowing invokeMethod calls to pass between threads. | 527 | // if they access Settings or Menu in any of their shutdown code. So: |
| 528 | QCoreApplication::processEvents(); | 528 | // Process events for this thread, allowing invokeMethod calls to pass between threads. |
| 529 | QCoreApplication::processEvents(); | ||
| 530 | } | ||
| 529 | 531 | ||
| 530 | // Avoid a pure busy wait | 532 | // Avoid a pure busy wait |
| 531 | QThread::yieldCurrentThread(); | 533 | QThread::yieldCurrentThread(); |