mirror of
https://github.com/lubosz/overte.git
synced 2025-04-09 08:22:30 +02:00
Merge pull request #13536 from SimonWalton-HiFi/script-engine-thread-agent
ScriptsModel instances should be created & destroyed on the same thread (for Agent)
This commit is contained in:
commit
243bd5ea69
4 changed files with 13 additions and 8 deletions
|
@ -827,10 +827,6 @@ void Agent::processAgentAvatarAudio() {
|
|||
void Agent::aboutToFinish() {
|
||||
setIsAvatar(false);// will stop timers for sending identity packets
|
||||
|
||||
if (_scriptEngine) {
|
||||
_scriptEngine->stop();
|
||||
}
|
||||
|
||||
// our entity tree is going to go away so tell that to the EntityScriptingInterface
|
||||
DependencyManager::get<EntityScriptingInterface>()->setEntityTree(nullptr);
|
||||
|
||||
|
@ -843,7 +839,6 @@ void Agent::aboutToFinish() {
|
|||
|
||||
// destroy all other created dependencies
|
||||
DependencyManager::destroy<ScriptCache>();
|
||||
DependencyManager::destroy<ScriptEngines>();
|
||||
|
||||
DependencyManager::destroy<ResourceCacheSharedItems>();
|
||||
DependencyManager::destroy<SoundCacheScriptingInterface>();
|
||||
|
@ -862,3 +857,11 @@ void Agent::aboutToFinish() {
|
|||
_encoder = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Agent::stop() {
|
||||
if (_scriptEngine) {
|
||||
_scriptEngine->stop();
|
||||
} else {
|
||||
setFinished(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,8 @@ public slots:
|
|||
void setIsAvatar(bool isAvatar);
|
||||
bool isAvatar() const { return _isAvatar; }
|
||||
|
||||
Q_INVOKABLE virtual void stop() override;
|
||||
|
||||
private slots:
|
||||
void requestScript();
|
||||
void scriptRequestFinished();
|
||||
|
|
|
@ -120,7 +120,7 @@ void ThreadedAssignment::checkInWithDomainServerOrExit() {
|
|||
if (_numQueuedCheckIns >= MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
|
||||
qCDebug(networking) << "At least" << MAX_SILENT_DOMAIN_SERVER_CHECK_INS << "have been queued without a response from domain-server"
|
||||
<< "Stopping the current assignment";
|
||||
setFinished(true);
|
||||
stop();
|
||||
} else {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
QMetaObject::invokeMethod(nodeList.data(), "sendDomainServerCheckIn");
|
||||
|
@ -132,5 +132,5 @@ void ThreadedAssignment::checkInWithDomainServerOrExit() {
|
|||
|
||||
void ThreadedAssignment::domainSettingsRequestFailed() {
|
||||
qCDebug(networking) << "Failed to retreive settings object from domain-server. Bailing on assignment.";
|
||||
setFinished(true);
|
||||
stop();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ public:
|
|||
ThreadedAssignment(ReceivedMessage& message);
|
||||
~ThreadedAssignment() { stop(); }
|
||||
|
||||
void setFinished(bool isFinished);
|
||||
virtual void aboutToFinish() { };
|
||||
void addPacketStatsAndSendStatsPacket(QJsonObject statsObject);
|
||||
|
||||
|
@ -43,6 +42,7 @@ signals:
|
|||
|
||||
protected:
|
||||
void commonInit(const QString& targetName, NodeType_t nodeType);
|
||||
void setFinished(bool isFinished);
|
||||
|
||||
bool _isFinished;
|
||||
QTimer _domainServerTimer;
|
||||
|
|
Loading…
Reference in a new issue