quit the ScriptEngine thread once the script is done

This commit is contained in:
Stephen Birarda 2015-07-17 11:18:11 -07:00
parent eaeaa23f03
commit 7a13c867ae
2 changed files with 6 additions and 9 deletions

View file

@ -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);

View file

@ -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;