From 8469061ce5788d463600cb483ba0d0fce454031e Mon Sep 17 00:00:00 2001 From: Johan Malm Date: Wed, 3 Jun 2026 21:20:21 +0100 Subject: [PATCH] xdg-shell: protect against SIGABRT when TTY switching Ensure we have got sensible toplevel width/height before trying to set size on configure. This protects against an edge case experienced when TTY switching between labwc and Xfce running on XOrg on another TTY. It is not yet clear what causes this, but hitting wlroots assert() is not great, so let's protect against it. Written-by: @Tamaranch Fixes: #3608 --- src/xdg.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/xdg.c b/src/xdg.c index 03035d63..ccba0de1 100644 --- a/src/xdg.c +++ b/src/xdg.c @@ -621,7 +621,24 @@ xdg_toplevel_view_configure(struct view *view, struct wlr_box geo) if (geo.width != view->pending.width || geo.height != view->pending.height) { if (toplevel->base->initialized) { - serial = wlr_xdg_toplevel_set_size(toplevel, geo.width, geo.height); + /* + * geo.{width,height} are checked here to guard against + * an odd edge-case reported in #3608 which involves TTY + * switching between labwc and Xfce running on X.Org on + * another TTY. It is not yet clear what causes this, + * but hitting wlroots assert() is not great, so let's + * protect against it. + * + * Ref: + * - https://github.com/labwc/labwc/issues/3608 + */ + if (geo.width > 0 && geo.height > 0) { + serial = wlr_xdg_toplevel_set_size(toplevel, + geo.width, geo.height); + } else { + wlr_log(WLR_ERROR, "cannot set size %dx%d", + geo.width, geo.height); + } } else { /* * This may happen, for example, when a panel resizes because a