Skip to content

Commit

Permalink
Remove listener when window is destroyed (#3215)
Browse files Browse the repository at this point in the history
  • Loading branch information
eyusupov authored May 6, 2024
1 parent e7779b5 commit df1a9c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/modules/dwl/window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 7 additions & 1 deletion src/modules/dwl/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Window::Window(const std::string &id, const Bar &bar, const Json::Value &config)
wl_registry_add_listener(registry, &registry_listener_impl, this);
wl_display_roundtrip(display);

if (!status_manager_) {
if (status_manager_ == nullptr) {
spdlog::error("dwl_status_manager_v2 not advertised");
return;
}
Expand All @@ -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; }
Expand Down

0 comments on commit df1a9c5

Please sign in to comment.