mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +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() {
|
void Agent::aboutToFinish() {
|
||||||
setIsAvatar(false);// will stop timers for sending identity packets
|
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
|
// our entity tree is going to go away so tell that to the EntityScriptingInterface
|
||||||
DependencyManager::get<EntityScriptingInterface>()->setEntityTree(nullptr);
|
DependencyManager::get<EntityScriptingInterface>()->setEntityTree(nullptr);
|
||||||
|
|
||||||
|
@ -843,7 +839,6 @@ void Agent::aboutToFinish() {
|
||||||
|
|
||||||
// destroy all other created dependencies
|
// destroy all other created dependencies
|
||||||
DependencyManager::destroy<ScriptCache>();
|
DependencyManager::destroy<ScriptCache>();
|
||||||
DependencyManager::destroy<ScriptEngines>();
|
|
||||||
|
|
||||||
DependencyManager::destroy<ResourceCacheSharedItems>();
|
DependencyManager::destroy<ResourceCacheSharedItems>();
|
||||||
DependencyManager::destroy<SoundCacheScriptingInterface>();
|
DependencyManager::destroy<SoundCacheScriptingInterface>();
|
||||||
|
@ -862,3 +857,11 @@ void Agent::aboutToFinish() {
|
||||||
_encoder = nullptr;
|
_encoder = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Agent::stop() {
|
||||||
|
if (_scriptEngine) {
|
||||||
|
_scriptEngine->stop();
|
||||||
|
} else {
|
||||||
|
setFinished(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -67,6 +67,8 @@ public slots:
|
||||||
void setIsAvatar(bool isAvatar);
|
void setIsAvatar(bool isAvatar);
|
||||||
bool isAvatar() const { return _isAvatar; }
|
bool isAvatar() const { return _isAvatar; }
|
||||||
|
|
||||||
|
Q_INVOKABLE virtual void stop() override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void requestScript();
|
void requestScript();
|
||||||
void scriptRequestFinished();
|
void scriptRequestFinished();
|
||||||
|
|
|
@ -120,7 +120,7 @@ void ThreadedAssignment::checkInWithDomainServerOrExit() {
|
||||||
if (_numQueuedCheckIns >= MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
|
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"
|
qCDebug(networking) << "At least" << MAX_SILENT_DOMAIN_SERVER_CHECK_INS << "have been queued without a response from domain-server"
|
||||||
<< "Stopping the current assignment";
|
<< "Stopping the current assignment";
|
||||||
setFinished(true);
|
stop();
|
||||||
} else {
|
} else {
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
QMetaObject::invokeMethod(nodeList.data(), "sendDomainServerCheckIn");
|
QMetaObject::invokeMethod(nodeList.data(), "sendDomainServerCheckIn");
|
||||||
|
@ -132,5 +132,5 @@ void ThreadedAssignment::checkInWithDomainServerOrExit() {
|
||||||
|
|
||||||
void ThreadedAssignment::domainSettingsRequestFailed() {
|
void ThreadedAssignment::domainSettingsRequestFailed() {
|
||||||
qCDebug(networking) << "Failed to retreive settings object from domain-server. Bailing on assignment.";
|
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(ReceivedMessage& message);
|
||||||
~ThreadedAssignment() { stop(); }
|
~ThreadedAssignment() { stop(); }
|
||||||
|
|
||||||
void setFinished(bool isFinished);
|
|
||||||
virtual void aboutToFinish() { };
|
virtual void aboutToFinish() { };
|
||||||
void addPacketStatsAndSendStatsPacket(QJsonObject statsObject);
|
void addPacketStatsAndSendStatsPacket(QJsonObject statsObject);
|
||||||
|
|
||||||
|
@ -43,6 +42,7 @@ signals:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void commonInit(const QString& targetName, NodeType_t nodeType);
|
void commonInit(const QString& targetName, NodeType_t nodeType);
|
||||||
|
void setFinished(bool isFinished);
|
||||||
|
|
||||||
bool _isFinished;
|
bool _isFinished;
|
||||||
QTimer _domainServerTimer;
|
QTimer _domainServerTimer;
|
||||||
|
|
Loading…
Reference in a new issue