History

loading fix

HifiExperiments committed 5 years ago

Commit b6744581 parent 81940214 files · +12 −10Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 4 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+9−7
@@ -451,7 +451,7 @@ void ScriptEngine::executeOnScriptThread(std::function<void()> function, const Q · 450 unmodified lines
451451 function();
452452 }
453453
454−void ScriptEngine::waitTillDoneRunning() {
454+void ScriptEngine::waitTillDoneRunning(bool shutdown) {
455455 // Engine should be stopped already, but be defensive
456456 stop();
457457
@@ -520,12 +520,14 @@ void ScriptEngine::waitTillDoneRunning() { · 62 unmodified lines
520520 }
521521 }
522522
523− // NOTE: This will be called on the main application thread (among other threads) from stopAllScripts.
524− // The thread will need to continue to process events, because
525− // the scripts will likely need to marshall messages across to the main thread, e.g.
526− // if they access Settings or Menu in any of their shutdown code. So:
527− // Process events for this thread, allowing invokeMethod calls to pass between threads.
528− QCoreApplication::processEvents();
523+ if (shutdown) {
524+ // NOTE: This will be called on the main application thread (among other threads) from stopAllScripts.
525+ // The thread will need to continue to process events, because
526+ // the scripts will likely need to marshall messages across to the main thread, e.g.
527+ // if they access Settings or Menu in any of their shutdown code. So:
528+ // Process events for this thread, allowing invokeMethod calls to pass between threads.
529+ QCoreApplication::processEvents();
530+ }
529531
530532 // Avoid a pure busy wait
531533 QThread::yieldCurrentThread();