Merge pull request #15830 from jherico/fix/bugz-771

BUGZ-771: Prevent duplicates from accumulating in EntityTree::_needsParentFixup
This commit is contained in:
Bradley Austin Davis 2019-06-24 15:15:10 -07:00 committed by GitHub
commit 71fb1183be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2121,9 +2121,10 @@ void EntityTree::fixupNeedsParentFixups() {
_needsParentFixup.clear();
}
std::unordered_set<QUuid> seenEntityIds;
QMutableVectorIterator<EntityItemWeakPointer> iter(entitiesToFixup);
while (iter.hasNext()) {
EntityItemWeakPointer entityWP = iter.next();
const auto& entityWP = iter.next();
EntityItemPointer entity = entityWP.lock();
if (!entity) {
// entity was deleted before we found its parent
@ -2131,6 +2132,17 @@ void EntityTree::fixupNeedsParentFixups() {
continue;
}
const auto id = entity->getID();
// BUGZ-771 some entities seem to never be removed by the below logic and further seem to accumulate dupes within the _needsParentFixup list
// This block ensures that duplicates are removed from entitiesToFixup before it's re-appended to _needsParentFixup
if (0 != seenEntityIds.count(id)) {
// Entity was duplicated inside entitiesToFixup
iter.remove();
continue;
}
seenEntityIds.insert(id);
entity->requiresRecalcBoxes();
bool queryAACubeSuccess { false };
bool maxAACubeSuccess { false };