From 048871222f5445b4b66b2c3e8d43def11cc7f3d0 Mon Sep 17 00:00:00 2001 From: light7734 Date: Thu, 18 Sep 2025 20:08:06 +0330 Subject: [PATCH] fix(surface): components getting removed AFTER registry callbacks getting disconnected --- modules/surface/private/linux/system.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/surface/private/linux/system.cpp b/modules/surface/private/linux/system.cpp index b4f1a39..b46b152 100644 --- a/modules/surface/private/linux/system.cpp +++ b/modules/surface/private/linux/system.cpp @@ -59,6 +59,10 @@ System::System(Ref registry): m_registry(std::move(registry)) System::~System() { + m_registry->view().each([&](const entt::entity entity, SurfaceComponent &) { + m_registry->get_entt_registry().remove(entity); + }); + m_registry->get_entt_registry() .on_construct() .disconnect<&System::on_surface_construct>(this); @@ -70,11 +74,6 @@ System::~System() m_registry->get_entt_registry() .on_destroy() .disconnect<&System::on_surface_destroy>(this); - - - m_registry->view().each([&](const entt::entity entity, SurfaceComponent &) { - m_registry->get_entt_registry().remove(entity); - }); } void System::on_register()