From 2c2a2ec38055092f368b44d4affefdfa8df17ff9 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 14 Mar 2026 13:08:24 +0100 Subject: [PATCH 1/5] common/pango: ensure we return zero on get_text_size() error Avoid leaving out pointers undefined. --- common/pango.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/pango.c b/common/pango.c index e52b52b93..9efa93f7e 100644 --- a/common/pango.c +++ b/common/pango.c @@ -84,6 +84,8 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc, void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height, int *baseline, double scale, bool markup, const char *fmt, ...) { + *width = *height = *baseline = 0; + va_list args; va_start(args, fmt); char *buf = vformat_str(fmt, args); From 9d0dbe66c307bbb227ce746d76b66b647350906b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 14 Mar 2026 13:09:52 +0100 Subject: [PATCH 2/5] common/pango: log on get_text_size()/render_text() format failure --- common/pango.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/pango.c b/common/pango.c index 9efa93f7e..5c7ff3076 100644 --- a/common/pango.c +++ b/common/pango.c @@ -91,6 +91,7 @@ void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, char *buf = vformat_str(fmt, args); va_end(args); if (buf == NULL) { + sway_log(SWAY_ERROR, "Failed to format string"); return; } @@ -127,6 +128,7 @@ void render_text(cairo_t *cairo, const PangoFontDescription *desc, char *buf = vformat_str(fmt, args); va_end(args); if (buf == NULL) { + sway_log(SWAY_ERROR, "Failed to format string"); return; } From 40e1dcd29f1950236e184bd653ee5ede55d8202b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 14 Mar 2026 13:21:55 +0100 Subject: [PATCH 3/5] common/pango: add error handling to get_text_size()/render_text() Closes: https://github.com/swaywm/sway/issues/9054 --- common/pango.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/common/pango.c b/common/pango.c index 5c7ff3076..2445b7227 100644 --- a/common/pango.c +++ b/common/pango.c @@ -97,12 +97,20 @@ void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, PangoLayout *layout = get_pango_layout(cairo, desc, buf, scale, markup); pango_cairo_update_layout(cairo, layout); + cairo_status_t status = cairo_status(cairo); + if (status != CAIRO_STATUS_SUCCESS) { + sway_log(SWAY_ERROR, "pango_cairo_update_layout() failed: %s", + cairo_status_to_string(status)); + goto out; + } + pango_layout_get_pixel_size(layout, width, height); if (baseline) { *baseline = pango_layout_get_baseline(layout) / PANGO_SCALE; } - g_object_unref(layout); +out: + g_object_unref(layout); free(buf); } @@ -137,9 +145,18 @@ void render_text(cairo_t *cairo, const PangoFontDescription *desc, cairo_get_font_options(cairo, fo); pango_cairo_context_set_font_options(pango_layout_get_context(layout), fo); cairo_font_options_destroy(fo); - pango_cairo_update_layout(cairo, layout); - pango_cairo_show_layout(cairo, layout); - g_object_unref(layout); + pango_cairo_update_layout(cairo, layout); + cairo_status_t status = cairo_status(cairo); + if (status != CAIRO_STATUS_SUCCESS) { + sway_log(SWAY_ERROR, "pango_cairo_update_layout() failed: %s", + cairo_status_to_string(status)); + goto out; + } + + pango_cairo_show_layout(cairo, layout); + +out: + g_object_unref(layout); free(buf); } From 85a4b19ac44f766561d4b47f587d97575c780ad0 Mon Sep 17 00:00:00 2001 From: llyyr Date: Fri, 20 Mar 2026 01:49:08 +0530 Subject: [PATCH 4/5] build: bump wlroots version Upstream bumped to 0.21.0-dev https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/627da39e76d1f5a3cd18730bd305a0351bb1a121 --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 974a4071b..77d7ff613 100644 --- a/meson.build +++ b/meson.build @@ -39,14 +39,14 @@ if is_freebsd endif # Execute the wlroots subproject, if any -wlroots_version = ['>=0.20.0', '<0.21.0'] +wlroots_version = ['>=0.21.0', '<0.22.0'] subproject( 'wlroots', default_options: ['examples=false'], required: false, version: wlroots_version, ) -wlroots = dependency('wlroots-0.20', version: wlroots_version, fallback: 'wlroots') +wlroots = dependency('wlroots-0.21', version: wlroots_version, fallback: 'wlroots') wlroots_features = { 'xwayland': false, 'libinput_backend': false, From 82227d6103940bade22d7fa1e63256228df37b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Poisot?= Date: Fri, 20 Mar 2026 08:47:57 +0000 Subject: [PATCH 5/5] common/pango: get_text_size out pointers may be NULL Fixes: 2c2a2ec38055092f368b44d4affefdfa8df17ff9 Closes: https://github.com/swaywm/sway/issues/9082 --- common/pango.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/pango.c b/common/pango.c index 2445b7227..662b3699e 100644 --- a/common/pango.c +++ b/common/pango.c @@ -84,7 +84,15 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc, void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height, int *baseline, double scale, bool markup, const char *fmt, ...) { - *width = *height = *baseline = 0; + if (width) { + *width = 0; + } + if (height) { + *height = 0; + } + if (baseline) { + *baseline = 0; + } va_list args; va_start(args, fmt);