Skip to content

Entities retain relations to removed entities #113

@opl-

Description

@opl-

A relation to another entity isn't removed when the target entity is removed. Entity.getRelationsByKind() continues to return removed entities:

with(geary) {
	val entityA = entity()
	val entityB = entity()

	// Using a random component.
	entityA.addRelation(components.noInherit, entityB.id)
	entityB.removeEntity()

	// Throws .-.
	check(entityA.getRelationsByKind(components.noInherit).isEmpty())
}

This is disastrous if entity id reuse is enabled.

Additionally, no event is emitted on the entity owning the relation, preventing cleanup without listening to all OnEntityRemoved events and iterating over all entities with that relation (obviously slow).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions