This removes an invalid comment - waitTillDoneRunning is not only called from the main thread - and remove a check to make sure thread() is not null because it should no longer be deleted before ScriptEngine.
Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all
Unified · Split
| @@ -397,16 +397,12 @@ void ScriptEngine::waitTillDoneRunning() { · 396 unmodified lines | ||
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | − // NOTE: This will be called on the main application thread from stopAllScripts. | |
| 401 | − // The application thread will need to continue to process events, because | |
| 400 | + // NOTE: This will be called on the main application thread (among other threads) from stopAllScripts. | |
| 401 | + // The thread will need to continue to process events, because | |
| 402 | 402 | // the scripts will likely need to marshall messages across to the main thread, e.g. |
| 403 | 403 | // if they access Settings or Menu in any of their shutdown code. So: |
| 404 | − // Process events for the main application thread, allowing invokeMethod calls to pass between threads. | |
| 404 | + // Process events for this thread, allowing invokeMethod calls to pass between threads. | |
| 405 | 405 | QCoreApplication::processEvents(); |
| 406 | − // In some cases (debugging), processEvents may give the thread enough time to shut down, so recheck it. | |
| 407 | − if (!thread()) { | |
| 408 | − break; | |
| 409 | − } | |
| 410 | 406 | |
| 411 | 407 | // Avoid a pure busy wait |
| 412 | 408 | QThread::yieldCurrentThread(); |