mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 16:41:02 +02:00
unhook node bag from element notifications on shutdown to speed up cleanup
This commit is contained in:
parent
779b5a6827
commit
f3aa9d3b8f
3 changed files with 12 additions and 1 deletions
|
@ -62,6 +62,7 @@ void OctreeQueryNode::nodeKilled() {
|
||||||
// while the thread actually shuts down
|
// while the thread actually shuts down
|
||||||
_octreeSendThread->setIsShuttingDown();
|
_octreeSendThread->setIsShuttingDown();
|
||||||
}
|
}
|
||||||
|
nodeBag.unhookNotifications(); // if our node is shutting down, then we no longer need octree element notifications
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctreeQueryNode::forceNodeShutdown() {
|
void OctreeQueryNode::forceNodeShutdown() {
|
||||||
|
|
|
@ -16,13 +16,20 @@ OctreeElementBag::OctreeElementBag() :
|
||||||
_bagElements()
|
_bagElements()
|
||||||
{
|
{
|
||||||
OctreeElement::addDeleteHook(this);
|
OctreeElement::addDeleteHook(this);
|
||||||
|
_hooked = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
OctreeElementBag::~OctreeElementBag() {
|
OctreeElementBag::~OctreeElementBag() {
|
||||||
OctreeElement::removeDeleteHook(this);
|
unhookNotifications();
|
||||||
deleteAll();
|
deleteAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OctreeElementBag::unhookNotifications() {
|
||||||
|
if (_hooked) {
|
||||||
|
OctreeElement::removeDeleteHook(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OctreeElementBag::elementDeleted(OctreeElement* element) {
|
void OctreeElementBag::elementDeleted(OctreeElement* element) {
|
||||||
qDebug() << "OctreeElementBag::elementDeleted()...";
|
qDebug() << "OctreeElementBag::elementDeleted()...";
|
||||||
remove(element); // note: remove can safely handle nodes that aren't in it, so we don't need to check contains()
|
remove(element); // note: remove can safely handle nodes that aren't in it, so we don't need to check contains()
|
||||||
|
|
|
@ -36,8 +36,11 @@ public:
|
||||||
void deleteAll();
|
void deleteAll();
|
||||||
virtual void elementDeleted(OctreeElement* element);
|
virtual void elementDeleted(OctreeElement* element);
|
||||||
|
|
||||||
|
void unhookNotifications();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSet<OctreeElement*> _bagElements;
|
QSet<OctreeElement*> _bagElements;
|
||||||
|
bool _hooked;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_OctreeElementBag_h
|
#endif // hifi_OctreeElementBag_h
|
||||||
|
|
Loading…
Reference in a new issue