correctly free popup items on destruction of parent

This commit is contained in:
Felix Kratz 2021-12-22 19:45:15 +01:00
parent 9f5c76f3f9
commit ce4f08b91a
2 changed files with 4 additions and 2 deletions

View file

@ -389,6 +389,7 @@ void bar_item_destroy(struct bar_item* bar_item) {
if (bar_item->group && bar_item->type == BAR_COMPONENT_GROUP) group_destroy(bar_item->group);
else if (bar_item->group) group_remove_member(bar_item->group, bar_item);
env_vars_destroy(&bar_item->signal_args.env_vars);
popup_destroy(&bar_item->popup);
free(bar_item);
}

View file

@ -1,6 +1,7 @@
#include "popup.h"
#include "background.h"
#include "bar_item.h"
#include "bar_manager.h"
#include "misc/helpers.h"
#include <stdint.h>
@ -145,10 +146,10 @@ void popup_draw(struct popup* popup) {
void popup_destroy(struct popup* popup) {
for (int i = 0; i < popup->num_items; i++) {
free(popup->items[i]);
bar_manager_remove_item(&g_bar_manager, popup->items[i]);
}
if (popup->items) free(popup->items);
if (popup->context) free(popup->context);
popup_close_window(popup);
}
static bool popup_parse_sub_domain(struct popup* popup, FILE* rsp, struct token property, char* message) {