fix(surface): components getting removed AFTER registry callbacks getting disconnected
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
light7734 2025-09-18 20:08:06 +03:30
parent d672b25844
commit 048871222f
Signed by: light7734
GPG key ID: 8C30176798F1A6BA

View file

@ -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()