Remove listener when window is destroyed (#3215)
parent
e7779b5458
commit
df1a9c5509
|
@ -14,7 +14,7 @@ namespace waybar::modules::dwl {
|
|||
class Window : public AAppIconLabel, public sigc::trackable {
|
||||
public:
|
||||
Window(const std::string &, const waybar::Bar &, const Json::Value &);
|
||||
virtual ~Window() = default;
|
||||
~Window();
|
||||
|
||||
void handle_layout(const uint32_t layout);
|
||||
void handle_title(const char *title);
|
||||
|
|
|
@ -80,7 +80,7 @@ Window::Window(const std::string &id, const Bar &bar, const Json::Value &config)
|
|||
wl_registry_add_listener(registry, ®istry_listener_impl, this);
|
||||
wl_display_roundtrip(display);
|
||||
|
||||
if (!status_manager_) {
|
||||
if (status_manager_ == nullptr) {
|
||||
spdlog::error("dwl_status_manager_v2 not advertised");
|
||||
return;
|
||||
}
|
||||
|
@ -91,6 +91,12 @@ Window::Window(const std::string &id, const Bar &bar, const Json::Value &config)
|
|||
zdwl_ipc_manager_v2_destroy(status_manager_);
|
||||
}
|
||||
|
||||
Window::~Window() {
|
||||
if (output_status_ != nullptr) {
|
||||
zdwl_ipc_output_v2_destroy(output_status_);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::handle_title(const char *title) { title_ = title; }
|
||||
|
||||
void Window::handle_appid(const char *appid) { appid_ = appid; }
|
||||
|
|
Loading…
Reference in New Issue