From dc0258219de7b8d30b4689805129d99dce987bb0 Mon Sep 17 00:00:00 2001 From: light7734 Date: Sun, 21 Sep 2025 09:48:55 +0330 Subject: [PATCH] refactor(surface): minor changes --- modules/surface/private/linux/system.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/surface/private/linux/system.cpp b/modules/surface/private/linux/system.cpp index c3a13d1..b90a134 100644 --- a/modules/surface/private/linux/system.cpp +++ b/modules/surface/private/linux/system.cpp @@ -58,7 +58,14 @@ System::System(Ref registry): m_registry(std::move(registry)) System::~System() { + // TODO(Light): make registry.remove not validate iterators + auto entities_to_remove = std::vector {}; for (auto &[entity, surface] : m_registry->view()) + { + entities_to_remove.emplace_back(entity); + } + + for (auto entity : entities_to_remove) { m_registry->remove(entity); } @@ -157,8 +164,11 @@ void System::on_surface_construct(ecs::Registry ®istry, ecs::Entity entity) XUnmapWindow(display, main_window); } } - catch (...) + catch (const std::exception &exp) { + log_err("Exception thrown when on_constructing surface component"); + log_err("\tentity: {}", entity); + log_err("\twhat: {}", exp.what()); registry.remove(entity); throw; }