mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
Deal with font_buffer_create() failures
This commit is contained in:
parent
94f199e3c5
commit
bda48da68d
3 changed files with 42 additions and 12 deletions
|
|
@ -103,6 +103,19 @@ item_create(struct menu *menu, const char *text)
|
|||
text, &font, theme->menu_items_text_color);
|
||||
font_buffer_create(&menuitem->selected.buffer, item_max_width,
|
||||
text, &font, theme->menu_items_active_text_color);
|
||||
if (!menuitem->normal.buffer || !menuitem->selected.buffer) {
|
||||
wlr_log(WLR_ERROR, "Failed to create menu item '%s'", text);
|
||||
if (menuitem->normal.buffer) {
|
||||
wlr_buffer_drop(&menuitem->normal.buffer->base);
|
||||
menuitem->normal.buffer = NULL;
|
||||
}
|
||||
if (menuitem->selected.buffer) {
|
||||
wlr_buffer_drop(&menuitem->selected.buffer->base);
|
||||
menuitem->selected.buffer = NULL;
|
||||
}
|
||||
free(menuitem);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Item background nodes */
|
||||
menuitem->normal.background = &wlr_scene_rect_create(parent,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue