mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:09:24 +02:00
avoid entity-server node/octree deadlock on shutdown
This commit is contained in:
parent
f86c064059
commit
55b4784a02
2 changed files with 14 additions and 5 deletions
|
@ -42,7 +42,7 @@ protected:
|
||||||
virtual bool process();
|
virtual bool process();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
OctreeServer* _myServer;
|
QPointer<OctreeServer> _myServer;
|
||||||
SharedNodePointer _node;
|
SharedNodePointer _node;
|
||||||
QUuid _nodeUUID;
|
QUuid _nodeUUID;
|
||||||
|
|
||||||
|
|
|
@ -1175,13 +1175,22 @@ void OctreeServer::aboutToFinish() {
|
||||||
if (_jurisdictionSender) {
|
if (_jurisdictionSender) {
|
||||||
_jurisdictionSender->terminating();
|
_jurisdictionSender->terminating();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QSet<SharedNodePointer> nodesToKill;
|
||||||
|
|
||||||
// force a shutdown of all of our OctreeSendThreads - at this point it has to be impossible for a
|
// Force a shutdown of all of our OctreeSendThreads.
|
||||||
// linkedDataCreateCallback to be called for a new node
|
// At this point it has to be impossible for a linkedDataCreateCallback to be called for a new node
|
||||||
nodeList->eachNode([this](const SharedNodePointer& node) {
|
nodeList->eachNode([&nodesToKill](const SharedNodePointer& node) {
|
||||||
|
nodesToKill << node;
|
||||||
|
});
|
||||||
|
|
||||||
|
// What follows is a hack to force OctreeSendThreads to cleanup before the OctreeServer is gone.
|
||||||
|
// I would prefer to allow the SharedNodePointer ref count drop to zero to do this automatically
|
||||||
|
// but that isn't possible as long as the OctreeSendThread has an OctreeServer* that it uses.
|
||||||
|
for (auto& node : nodesToKill) {
|
||||||
qDebug() << qPrintable(_safeServerName) << "server about to finish while node still connected node:" << *node;
|
qDebug() << qPrintable(_safeServerName) << "server about to finish while node still connected node:" << *node;
|
||||||
forceNodeShutdown(node);
|
forceNodeShutdown(node);
|
||||||
});
|
}
|
||||||
|
|
||||||
if (_persistThread) {
|
if (_persistThread) {
|
||||||
_persistThread->aboutToFinish();
|
_persistThread->aboutToFinish();
|
||||||
|
|
Loading…
Reference in a new issue