mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 11:13:37 +02:00
Merge pull request #16061 from SimonWalton-HiFi/entities-scriptengine-takedown
BUGZ-984: Wait for client entity-scripts to unload when shutting down
This commit is contained in:
commit
85da916a3b
4 changed files with 6 additions and 5 deletions
|
@ -2761,7 +2761,6 @@ void Application::cleanupBeforeQuit() {
|
|||
}
|
||||
|
||||
getEntities()->shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
|
||||
getEntities()->clear();
|
||||
|
||||
// Clear any queued processing (I/O, FBX/OBJ/Texture parsing)
|
||||
QThreadPool::globalInstance()->clear();
|
||||
|
|
|
@ -253,7 +253,7 @@ void EntityTreeRenderer::clear() {
|
|||
// unload and stop the engine
|
||||
if (_entitiesScriptEngine) {
|
||||
// do this here (instead of in deleter) to avoid marshalling unload signals back to this thread
|
||||
_entitiesScriptEngine->unloadAllEntityScripts();
|
||||
_entitiesScriptEngine->unloadAllEntityScripts(true);
|
||||
_entitiesScriptEngine->stop();
|
||||
}
|
||||
|
||||
|
|
|
@ -2470,13 +2470,14 @@ QList<EntityItemID> ScriptEngine::getListOfEntityScriptIDs() {
|
|||
return _entityScripts.keys();
|
||||
}
|
||||
|
||||
void ScriptEngine::unloadAllEntityScripts() {
|
||||
void ScriptEngine::unloadAllEntityScripts(bool blockingCall) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
#ifdef THREAD_DEBUGGING
|
||||
qCDebug(scriptengine) << "*** WARNING *** ScriptEngine::unloadAllEntityScripts() called on wrong thread [" << QThread::currentThread() << "], invoking on correct thread [" << thread() << "]";
|
||||
#endif
|
||||
|
||||
QMetaObject::invokeMethod(this, "unloadAllEntityScripts");
|
||||
QMetaObject::invokeMethod(this, "unloadAllEntityScripts",
|
||||
blockingCall ? Qt::BlockingQueuedConnection : Qt::QueuedConnection);
|
||||
return;
|
||||
}
|
||||
#ifdef THREAD_DEBUGGING
|
||||
|
|
|
@ -578,9 +578,10 @@ public:
|
|||
|
||||
/**jsdoc
|
||||
* @function Script.unloadAllEntityScripts
|
||||
* @param {boolean} [blockingCall=false] - Wait for completion if call moved to another thread.
|
||||
* @deprecated This function is deprecated and will be removed.
|
||||
*/
|
||||
Q_INVOKABLE void unloadAllEntityScripts();
|
||||
Q_INVOKABLE void unloadAllEntityScripts(bool blockingCall = false);
|
||||
|
||||
/**jsdoc
|
||||
* Calls a method in an entity script.
|
||||
|
|
Loading…
Reference in a new issue