mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 03:53:52 +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
|
||||
_octreeSendThread->setIsShuttingDown();
|
||||
}
|
||||
nodeBag.unhookNotifications(); // if our node is shutting down, then we no longer need octree element notifications
|
||||
}
|
||||
|
||||
void OctreeQueryNode::forceNodeShutdown() {
|
||||
|
|
|
@ -16,13 +16,20 @@ OctreeElementBag::OctreeElementBag() :
|
|||
_bagElements()
|
||||
{
|
||||
OctreeElement::addDeleteHook(this);
|
||||
_hooked = true;
|
||||
};
|
||||
|
||||
OctreeElementBag::~OctreeElementBag() {
|
||||
OctreeElement::removeDeleteHook(this);
|
||||
unhookNotifications();
|
||||
deleteAll();
|
||||
}
|
||||
|
||||
void OctreeElementBag::unhookNotifications() {
|
||||
if (_hooked) {
|
||||
OctreeElement::removeDeleteHook(this);
|
||||
}
|
||||
}
|
||||
|
||||
void OctreeElementBag::elementDeleted(OctreeElement* element) {
|
||||
qDebug() << "OctreeElementBag::elementDeleted()...";
|
||||
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();
|
||||
virtual void elementDeleted(OctreeElement* element);
|
||||
|
||||
void unhookNotifications();
|
||||
|
||||
private:
|
||||
QSet<OctreeElement*> _bagElements;
|
||||
bool _hooked;
|
||||
};
|
||||
|
||||
#endif // hifi_OctreeElementBag_h
|
||||
|
|
Loading…
Reference in a new issue