mirror of
https://github.com/gwenhael-le-moine/sway-patched-tray-menu.git
synced 2024-12-26 21:58:08 +01:00
Add cairo_image_surface_create error handling
cairo_image_surface_create can fail, e.g. when running out of memory or when the size is too big. Avoid crashing in this case. Closes: https://github.com/swaywm/sway/issues/6531
This commit is contained in:
parent
414950bbc8
commit
59aebaa5f9
1 changed files with 7 additions and 0 deletions
|
@ -536,6 +536,13 @@ static void render_titlebar_text_texture(struct sway_output *output,
|
|||
|
||||
cairo_surface_t *surface = cairo_image_surface_create(
|
||||
CAIRO_FORMAT_ARGB32, width, height);
|
||||
cairo_status_t status = cairo_surface_status(surface);
|
||||
if (status != CAIRO_STATUS_SUCCESS) {
|
||||
sway_log(SWAY_ERROR, "cairo_image_surface_create failed: %s",
|
||||
cairo_status_to_string(status));
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_t *cairo = cairo_create(surface);
|
||||
cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST);
|
||||
cairo_set_font_options(cairo, fo);
|
||||
|
|
Loading…
Reference in a new issue