mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:24:07 +02:00
quit the ScriptEngine thread once the script is done
This commit is contained in:
parent
eaeaa23f03
commit
7a13c867ae
2 changed files with 6 additions and 9 deletions
|
@ -4111,10 +4111,13 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
|
||||
// when the worker thread is started, call our engine's run..
|
||||
connect(workerThread, &QThread::started, scriptEngine, &ScriptEngine::run);
|
||||
|
||||
|
||||
// when the thread is terminated, add both scriptEngine and thread to the deleteLater queue
|
||||
connect(scriptEngine, SIGNAL(doneRunning()), scriptEngine, SLOT(deleteLater()));
|
||||
connect(workerThread, SIGNAL(finished()), workerThread, SLOT(deleteLater()));
|
||||
connect(scriptEngine, &ScriptEngine::doneRunning, scriptEngine, &ScriptEngine::deleteLater());
|
||||
connect(workerThread, &QThread::finished, workerThread, &Qthread::deleteLater);
|
||||
|
||||
// tell the thread to stop when the script engine is done
|
||||
connect(scriptEngine, &ScriptEngine::destroyed, workerThread, &QThread::quit);
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
connect(nodeList.data(), &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled);
|
||||
|
|
|
@ -720,12 +720,6 @@ void ScriptEngine::run() {
|
|||
}
|
||||
}
|
||||
|
||||
// If we were on a thread, then wait till it's done
|
||||
// Unless we're an assignment-client, in which case that's handled for us
|
||||
if (thread() && !_isAgent) {
|
||||
thread()->quit();
|
||||
}
|
||||
|
||||
emit finished(_fileNameString);
|
||||
|
||||
_isRunning = false;
|
||||
|
|
Loading…
Reference in a new issue