respond to code review

This commit is contained in:
Seth Alves 2015-09-11 09:29:52 -07:00
parent 7b656d5ead
commit b1c5a04531
4 changed files with 10 additions and 10 deletions

View file

@ -986,8 +986,8 @@ bool EntityItem::isMoving() const {
}
EntityTreePointer EntityItem::getTree() const {
EntityTreeElementPointer elt = getElement();
EntityTreePointer tree = elt ? elt->getTree() : nullptr;
EntityTreeElementPointer containingElement = getElement();
EntityTreePointer tree = containingElement ? containingElement->getTree() : nullptr;
return tree;
}

View file

@ -47,14 +47,14 @@ bool EntityScriptingInterface::canRez() {
return nodeList->getThisNodeCanRez();
}
void EntityScriptingInterface::setEntityTree(EntityTreePointer modelTree) {
void EntityScriptingInterface::setEntityTree(EntityTreePointer elementTree) {
if (_entityTree) {
disconnect(_entityTree.get(), &EntityTree::addingEntity, this, &EntityScriptingInterface::addingEntity);
disconnect(_entityTree.get(), &EntityTree::deletingEntity, this, &EntityScriptingInterface::deletingEntity);
disconnect(_entityTree.get(), &EntityTree::clearingEntities, this, &EntityScriptingInterface::clearingEntities);
}
_entityTree = modelTree;
_entityTree = elementTree;
if (_entityTree) {
connect(_entityTree.get(), &EntityTree::addingEntity, this, &EntityScriptingInterface::addingEntity);

View file

@ -45,9 +45,9 @@ void EntityTree::createRootElement() {
OctreeElementPointer EntityTree::createNewElement(unsigned char* octalCode) {
EntityTreeElementPointer newElement = EntityTreeElementPointer(new EntityTreeElement(octalCode),
// see comment int EntityTreeElement::createNewElement
[=](EntityTreeElement* elt) {
EntityTreeElementPointer tmpSharedPointer(elt);
elt->notifyDeleteHooks();
[=](EntityTreeElement* dyingElement) {
EntityTreeElementPointer tmpSharedPointer(dyingElement);
dyingElement->notifyDeleteHooks();
});
newElement->setTree(std::static_pointer_cast<EntityTree>(shared_from_this()));
return std::static_pointer_cast<OctreeElement>(newElement);

View file

@ -42,12 +42,12 @@ OctreeElementPointer EntityTreeElement::createNewElement(unsigned char* octalCod
// or the destructor wouldn't have been called). The destructor also can't
// make a new shared pointer -- shared_from_this() is forbidden in a destructor, and
// using OctreeElementPointer(this) also fails. So, I've installed a custom deleter:
[=](EntityTreeElement* elt) {
[=](EntityTreeElement* dyingElement) {
// make a new shared pointer with a reference count of 1 (and no custom deleter)
EntityTreeElementPointer tmpSharedPointer(elt);
EntityTreeElementPointer tmpSharedPointer(dyingElement);
// call notifyDeleteHooks which will use shared_from_this() to get this same
// shared pointer, for use with the elementDeleted calls.
elt->notifyDeleteHooks();
dyingElement->notifyDeleteHooks();
// And now tmpSharedPointer's reference count drops to zero and the
// normal destructors are called.
});