Skip to content

crash when destroying entities that are instances of prefabs that have a sparse component #1358

Closed
@jpeletier

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.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions