diff --git a/sway/sway_text_node.c b/sway/sway_text_node.c index 46ddac93c..c4fd3a260 100644 --- a/sway/sway_text_node.c +++ b/sway/sway_text_node.c @@ -202,18 +202,20 @@ static void text_calc_size(struct text_buffer *buffer) { CAIRO_CONTENT_COLOR_ALPHA, NULL); cairo_t *c = cairo_create(recorder); cairo_surface_destroy(recorder); - if (!c) { - sway_log(SWAY_ERROR, "cairo_t allocation failed"); - return; + if (cairo_status(c) != CAIRO_STATUS_SUCCESS) { + sway_log(SWAY_ERROR, "cairo_t allocation failed: %s", + cairo_status_to_string(cairo_status(c))); + goto out; } cairo_set_antialias(c, CAIRO_ANTIALIAS_BEST); get_text_size(c, config->font_description, &props->width, NULL, &props->baseline, 1, props->pango_markup, "%s", buffer->text); - cairo_destroy(c); wlr_scene_buffer_set_dest_size(buffer->buffer_node, get_text_width(props), props->height); +out: + cairo_destroy(c); } struct sway_text_node *sway_text_node_create(struct wlr_scene_tree *parent,