mirror of
https://github.com/swaywm/sway.git
synced 2026-03-22 05:34:04 -04:00
sway_text_node: properly check cairo_t status in text_calc_size
cairo_create never returns NULL, so the previous null check never triggered. Use cairo_status instead.
This commit is contained in:
parent
dea166a27c
commit
131045ce55
1 changed files with 6 additions and 4 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue