History

Add blocking to script unload for client entity-scripts

Simon Walton committed 7 years ago

Commit 9aacd131 parent 10118804 files · +6 −5Browse 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+3−2
@@ -2470,13 +2470,14 @@ QList<EntityItemID> ScriptEngine::getListOfEntityScriptIDs() { · 2469 unmodified lines
2470 return _entityScripts.keys();2470 return _entityScripts.keys();
2471}2471}
2472 2472
2473void ScriptEngine::unloadAllEntityScripts() {2473void ScriptEngine::unloadAllEntityScripts(bool blockingCall) {
2474 if (QThread::currentThread() != thread()) {2474 if (QThread::currentThread() != thread()) {
2475#ifdef THREAD_DEBUGGING2475#ifdef THREAD_DEBUGGING
2476 qCDebug(scriptengine) << "*** WARNING *** ScriptEngine::unloadAllEntityScripts() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]";2476 qCDebug(scriptengine) << "*** WARNING *** ScriptEngine::unloadAllEntityScripts() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]";
2477#endif2477#endif
2478 2478
2479 QMetaObject::invokeMethod(this, "unloadAllEntityScripts");2479 QMetaObject::invokeMethod(this, "unloadAllEntityScripts",
2480 blockingCall ? Qt::BlockingQueuedConnection : Qt::QueuedConnection);
2480 return;2481 return;
2481 }2482 }
2482#ifdef THREAD_DEBUGGING2483#ifdef THREAD_DEBUGGING