mirror of
https://codeberg.org/adnano/wmenu.git
synced 2026-02-16 22:05:22 -05:00
Free memory associated with the menu on exit
This commit is contained in:
parent
b247119ab3
commit
f7e6e0b4bf
5 changed files with 220 additions and 99 deletions
8
pango.c
8
pango.c
|
|
@ -13,12 +13,16 @@ int get_font_height(const char *fontstr) {
|
|||
PangoFontDescription *desc = pango_font_description_from_string(fontstr);
|
||||
PangoFont *font = pango_font_map_load_font(fontmap, context, desc);
|
||||
if (font == NULL) {
|
||||
pango_font_description_free(desc);
|
||||
g_object_unref(context);
|
||||
return -1;
|
||||
}
|
||||
PangoFontMetrics *metrics = pango_font_get_metrics(font, NULL);
|
||||
int height = pango_font_metrics_get_height(metrics) / PANGO_SCALE;
|
||||
pango_font_description_free(desc);
|
||||
pango_font_metrics_unref(metrics);
|
||||
g_object_unref(font);
|
||||
pango_font_description_free(desc);
|
||||
g_object_unref(context);
|
||||
return height;
|
||||
}
|
||||
|
||||
|
|
@ -32,8 +36,8 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
|
|||
pango_layout_set_font_description(layout, desc);
|
||||
pango_layout_set_single_paragraph_mode(layout, 1);
|
||||
pango_layout_set_attributes(layout, attrs);
|
||||
pango_attr_list_unref(attrs);
|
||||
pango_font_description_free(desc);
|
||||
pango_attr_list_unref(attrs);
|
||||
return layout;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue