Merge pull request #1338 from jfred9/master
bar: Fix crash when unplugging HDMI
This commit is contained in:
commit
39f42cdd7e
|
@ -112,14 +112,14 @@ class Bar {
|
||||||
Gtk::Box center_;
|
Gtk::Box center_;
|
||||||
Gtk::Box right_;
|
Gtk::Box right_;
|
||||||
Gtk::Box box_;
|
Gtk::Box box_;
|
||||||
std::vector<std::unique_ptr<waybar::AModule>> modules_left_;
|
std::vector<std::shared_ptr<waybar::AModule>> modules_left_;
|
||||||
std::vector<std::unique_ptr<waybar::AModule>> modules_center_;
|
std::vector<std::shared_ptr<waybar::AModule>> modules_center_;
|
||||||
std::vector<std::unique_ptr<waybar::AModule>> modules_right_;
|
std::vector<std::shared_ptr<waybar::AModule>> modules_right_;
|
||||||
#ifdef HAVE_SWAY
|
#ifdef HAVE_SWAY
|
||||||
using BarIpcClient = modules::sway::BarIpcClient;
|
using BarIpcClient = modules::sway::BarIpcClient;
|
||||||
std::unique_ptr<BarIpcClient> _ipc_client;
|
std::unique_ptr<BarIpcClient> _ipc_client;
|
||||||
#endif
|
#endif
|
||||||
std::vector<std::unique_ptr<waybar::AModule>> modules_all_;
|
std::vector<std::shared_ptr<waybar::AModule>> modules_all_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace waybar
|
} // namespace waybar
|
||||||
|
|
|
@ -735,18 +735,19 @@ void waybar::Bar::getModules(const Factory& factory, const std::string& pos, Gtk
|
||||||
module = factory.makeModule(ref);
|
module = factory.makeModule(ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
modules_all_.emplace_back(module);
|
std::shared_ptr<AModule> module_sp(module);
|
||||||
|
modules_all_.emplace_back(module_sp);
|
||||||
if (group) {
|
if (group) {
|
||||||
group->pack_start(*module, false, false);
|
group->pack_start(*module, false, false);
|
||||||
} else {
|
} else {
|
||||||
if (pos == "modules-left") {
|
if (pos == "modules-left") {
|
||||||
modules_left_.emplace_back(module);
|
modules_left_.emplace_back(module_sp);
|
||||||
}
|
}
|
||||||
if (pos == "modules-center") {
|
if (pos == "modules-center") {
|
||||||
modules_center_.emplace_back(module);
|
modules_center_.emplace_back(module_sp);
|
||||||
}
|
}
|
||||||
if (pos == "modules-right") {
|
if (pos == "modules-right") {
|
||||||
modules_right_.emplace_back(module);
|
modules_right_.emplace_back(module_sp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module->dp.connect([module, &name] {
|
module->dp.connect([module, &name] {
|
||||||
|
|
Loading…
Reference in New Issue