properly release image on background destruction

This commit is contained in:
Felix Kratz 2021-12-30 03:14:08 +01:00
parent 118190bfbc
commit 4d76e2e932
4 changed files with 9 additions and 0 deletions

View file

@ -99,6 +99,10 @@ void background_draw(struct background* background, CGContextRef context) {
draw_rect(context, background->bounds, &background->color, background->corner_radius, background->border_width, &background->border_color, false);
}
void background_destroy(struct background* background) {
image_destroy(&background->image);
}
static bool background_parse_sub_domain(struct background* background, FILE* rsp, struct token property, char* message) {
if (token_equals(property, PROPERTY_DRAWING))
return background_set_enabled(background, evaluate_boolean_state(get_token(&message), background->enabled));

View file

@ -408,6 +408,8 @@ void bar_item_destroy(struct bar_item* bar_item) {
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);
background_destroy(&bar_item->background);
free(bar_item);
}

View file

@ -436,6 +436,8 @@ void bar_manager_destroy(struct bar_manager* bar_manager) {
bar_destroy(bar_manager->bars[i]);
}
custom_events_destroy(&bar_manager->custom_events);
background_destroy(&bar_manager->background);
if (bar_manager->bars) free(bar_manager->bars);
}

View file

@ -137,6 +137,7 @@ void text_destroy_line(struct text* text) {
}
void text_destroy(struct text* text) {
background_destroy(&text->background);
if (text->string) free(text->string);
if (text->font_name) free(text->font_name);
if (text->font) CFRelease(text->font);