diff options
author | Simon Ser <contact@emersion.fr> | 2021-04-20 17:21:05 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-06-24 18:21:29 +0200 |
commit | 7d6b23a0beb97e519c8d4c72987c233ee3564dd4 (patch) | |
tree | 6ad4bfdea4e92411c75806dd63cf5aeddcd8e577 | |
parent | Prevent use-after-free on first bar subcommand error (diff) | |
download | sway-7d6b23a0beb97e519c8d4c72987c233ee3564dd4.tar.gz sway-7d6b23a0beb97e519c8d4c72987c233ee3564dd4.tar.zst sway-7d6b23a0beb97e519c8d4c72987c233ee3564dd4.zip |
Avoid creating zero-sized textures for titlebars
Creating a zero-sized wlr_texture is incorrect.
(cherry picked from commit 6327f1b36196d5b6e22be9c9f839f29d5f23f346)
-rw-r--r-- | sway/tree/container.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 68fbec2f..e36b915e 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -531,6 +531,10 @@ static void update_title_texture(struct sway_container *con, | |||
531 | cairo_surface_destroy(dummy_surface); | 531 | cairo_surface_destroy(dummy_surface); |
532 | cairo_destroy(c); | 532 | cairo_destroy(c); |
533 | 533 | ||
534 | if (width == 0 || height == 0) { | ||
535 | return; | ||
536 | } | ||
537 | |||
534 | cairo_surface_t *surface = cairo_image_surface_create( | 538 | cairo_surface_t *surface = cairo_image_surface_create( |
535 | CAIRO_FORMAT_ARGB32, width, height); | 539 | CAIRO_FORMAT_ARGB32, width, height); |
536 | cairo_t *cairo = cairo_create(surface); | 540 | cairo_t *cairo = cairo_create(surface); |