refactor(surface): minor changes
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
light7734 2025-09-21 09:48:55 +03:30
parent 8b98768539
commit dc0258219d
Signed by: light7734
GPG key ID: 8C30176798F1A6BA

View file

@ -58,7 +58,14 @@ System::System(Ref<ecs::Registry> registry): m_registry(std::move(registry))
System::~System() System::~System()
{ {
// TODO(Light): make registry.remove not validate iterators
auto entities_to_remove = std::vector<ecs::Entity> {};
for (auto &[entity, surface] : m_registry->view<SurfaceComponent>()) for (auto &[entity, surface] : m_registry->view<SurfaceComponent>())
{
entities_to_remove.emplace_back(entity);
}
for (auto entity : entities_to_remove)
{ {
m_registry->remove<SurfaceComponent>(entity); m_registry->remove<SurfaceComponent>(entity);
} }
@ -157,8 +164,11 @@ void System::on_surface_construct(ecs::Registry &registry, ecs::Entity entity)
XUnmapWindow(display, main_window); 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<SurfaceComponent>(entity); registry.remove<SurfaceComponent>(entity);
throw; throw;
} }