Merge pull request #13755 from SimonWalton-HiFi/script-agent-destroy-engine

Fix for ScriptEngines not being released upon AC shutdown
This commit is contained in:
John Conklin II 2018-08-16 13:16:04 -07:00 committed by GitHub
commit 7f3bbaf3f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,8 +82,6 @@ Agent::Agent(ReceivedMessage& message) :
DependencyManager::set<recording::ClipCache>();
DependencyManager::set<ScriptCache>();
DependencyManager::set<ScriptEngines>(ScriptEngine::AGENT_SCRIPT);
DependencyManager::set<RecordingScriptingInterface>();
DependencyManager::set<UsersScriptingInterface>();
@ -162,6 +160,8 @@ void Agent::handleAudioPacket(QSharedPointer<ReceivedMessage> message) {
static const QString AGENT_LOGGING_NAME = "agent";
void Agent::run() {
// Create ScriptEngines on threaded-assignment thread then move to main thread.
DependencyManager::set<ScriptEngines>(ScriptEngine::AGENT_SCRIPT)->moveToThread(qApp->thread());
// make sure we request our script once the agent connects to the domain
auto nodeList = DependencyManager::get<NodeList>();
@ -497,7 +497,6 @@ void Agent::executeScript() {
Frame::clearFrameHandler(AVATAR_FRAME_TYPE);
DependencyManager::destroy<RecordingScriptingInterface>();
setFinished(true);
}
@ -847,7 +846,7 @@ void Agent::aboutToFinish() {
DependencyManager::destroy<recording::Deck>();
DependencyManager::destroy<recording::Recorder>();
DependencyManager::destroy<recording::ClipCache>();
DependencyManager::destroy<ScriptEngine>();
QMetaObject::invokeMethod(&_avatarAudioTimer, "stop");
// cleanup codec & encoder