Skip to content

Commit

Permalink
tray: fix memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ianyfan authored and emersion committed Feb 16, 2019
1 parent 26d6360 commit f54077d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion swaybar/tray/item.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ void destroy_sni(struct swaybar_sni *sni) {
return;
}

cairo_surface_destroy(sni->icon);

sd_bus_slot_unref(sni->new_icon_slot);
sd_bus_slot_unref(sni->new_attention_icon_slot);
sd_bus_slot_unref(sni->new_status_slot);
Expand All @@ -308,9 +310,11 @@ void destroy_sni(struct swaybar_sni *sni) {
free(sni->path);
free(sni->status);
free(sni->icon_name);
free(sni->icon_pixmap);
list_free_items_and_destroy(sni->icon_pixmap);
free(sni->attention_icon_name);
list_free_items_and_destroy(sni->attention_icon_pixmap);
free(sni->menu);
free(sni->icon_theme_path);
free(sni);
}

Expand Down
4 changes: 2 additions & 2 deletions swaybar/tray/watcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ struct swaybar_watcher *create_watcher(char *protocol, sd_bus *bus) {
goto error;
}

sd_bus_slot_set_floating(signal_slot, 1);
sd_bus_slot_set_floating(vtable_slot, 1);
sd_bus_slot_set_floating(signal_slot, 0);
sd_bus_slot_set_floating(vtable_slot, 0);

watcher->bus = bus;
watcher->hosts = create_list();
Expand Down

0 comments on commit f54077d

Please sign in to comment.