crash when destroying entities that are instances of prefabs that have a sparse component #1358
Closed
Description
Describe the bug
When destroying an entity that is an instance of a prefab that has a sparse component, I get the following assert and a crash:
fatal: sparse.c: 621: assert: dense < sparse->count INTERNAL_ERROR
To Reproduce
struct Attribute {
int value;
};
flecs::world ecs;
ecs.component<Attribute>().add(flecs::Sparse);
auto prefab = ecs.prefab("my prefab").add<Attribute>();
auto instance = ecs.entity().is_a(prefab);
instance.destruct(); // fatal: sparse.c: 621: assert: dense < sparse->count INTERNAL_ERROR
Expected behavior
Entity destroyed as normal.