fix(bar): ensure exception safety when creating group modules using std::unique_ptr

This commit is contained in:
Visal Vijay
2026-04-03 19:47:17 +05:30
parent 1e965ccce0
commit 36518e4eca
+5 -3
View File
@@ -545,9 +545,11 @@ void waybar::Bar::getModules(const Factory& factory, const std::string& pos,
if (group_config["modules"].isNull()) { if (group_config["modules"].isNull()) {
spdlog::warn("Group definition '{}' has not been found, group will be hidden", ref); spdlog::warn("Group definition '{}' has not been found, group will be hidden", ref);
} }
auto* group_module = new waybar::Group(id_name, class_name, group_config, vertical); auto group_module = std::make_unique<waybar::Group>(
getModules(factory, ref, group_module); id_name, class_name, group_config, vertical);
module = group_module;
getModules(factory, ref, group_module.get());
module = group_module.release();
} else { } else {
module = factory.makeModule(ref, pos); module = factory.makeModule(ref, pos);
} }