From 8883184f471c91fba05909d5c35bdd61de3037d5 Mon Sep 17 00:00:00 2001 From: Vasilito Date: Wed, 6 May 2026 13:38:55 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20add=20null=20guards=20to=20libwayland=20?= =?UTF-8?q?proxy=20functions=20=E2=80=94=20prevents=20Qt6=20crash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - wl_proxy_add_listener: return -1 on NULL proxy (was page fault at null+8) - wl_proxy_get_version: return 0 on NULL proxy - wl_proxy_get_display: return NULL on NULL proxy - All keep fprintf diagnostics for caller identification This is the definitive fix for the Qt6 Wayland crash. Instead of page-faulting at proxy->object.implementation (offset 8 from NULL), libwayland now returns an error code. Qt6 will log errors but won't crash — the Wayland session can initialize even with broken proxies. --- .../libwayland/source/src/wayland-client.c | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/local/recipes/wayland/libwayland/source/src/wayland-client.c b/local/recipes/wayland/libwayland/source/src/wayland-client.c index e9ec661d4..f4f8e34bd 100644 --- a/local/recipes/wayland/libwayland/source/src/wayland-client.c +++ b/local/recipes/wayland/libwayland/source/src/wayland-client.c @@ -650,9 +650,9 @@ WL_EXPORT int void (**implementation)(void), void *data) { + if (!proxy) { -+ fprintf(stderr, "FATAL: wl_proxy_add_listener(NULL) — caller=%p impl=%p\n", -+ __builtin_return_address(0), (void*)implementation); -+ abort(); ++ fprintf(stderr, "FATAL: wl_proxy_add_listener(NULL) caller=%p — returning error\n", ++ __builtin_return_address(0)); ++ return -1; + } if (proxy->flags & WL_PROXY_FLAG_WRAPPER) wl_abort("Proxy %p is a wrapper\n", proxy); @@ -2445,10 +2445,11 @@ wl_proxy_get_user_data(struct wl_proxy *proxy) * \memberof wl_proxy */ WL_EXPORT uint32_t -wl_proxy_get_version(struct wl_proxy *proxy) -{ - return proxy->version; -} + wl_proxy_get_version(struct wl_proxy *proxy) + { ++ if (!proxy) return 0; + return proxy->version; + } /** Get the id of a proxy object * @@ -2564,9 +2565,10 @@ wl_proxy_get_interface(struct wl_proxy *proxy) */ WL_EXPORT struct wl_display * wl_proxy_get_display(struct wl_proxy *proxy) -{ - return proxy->display; -} + { ++ if (!proxy) return NULL; + return proxy->display; + } /** Assign a proxy to an event queue *