fix(surface): components getting removed AFTER registry callbacks getting disconnected
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
d672b25844
commit
048871222f
1 changed files with 4 additions and 5 deletions
|
@ -59,6 +59,10 @@ System::System(Ref<ecs::Registry> registry): m_registry(std::move(registry))
|
|||
|
||||
System::~System()
|
||||
{
|
||||
m_registry->view<SurfaceComponent>().each([&](const entt::entity entity, SurfaceComponent &) {
|
||||
m_registry->get_entt_registry().remove<SurfaceComponent>(entity);
|
||||
});
|
||||
|
||||
m_registry->get_entt_registry()
|
||||
.on_construct<SurfaceComponent>()
|
||||
.disconnect<&System::on_surface_construct>(this);
|
||||
|
@ -70,11 +74,6 @@ System::~System()
|
|||
m_registry->get_entt_registry()
|
||||
.on_destroy<SurfaceComponent>()
|
||||
.disconnect<&System::on_surface_destroy>(this);
|
||||
|
||||
|
||||
m_registry->view<SurfaceComponent>().each([&](const entt::entity entity, SurfaceComponent &) {
|
||||
m_registry->get_entt_registry().remove<SurfaceComponent>(entity);
|
||||
});
|
||||
}
|
||||
|
||||
void System::on_register()
|
||||
|
|
Loading…
Add table
Reference in a new issue