fix: Qt6 Wayland crash — root cause identified, kded6 fix deployed

ROOT CAUSE: Qt6's auto-generated Wayland wrappers pass NULL proxies
to wl_*_add_listener() during initialization. The generated code stores
wlRegistryBind() return value in m_wl_* member without null check,
then init_listener() calls wl_*_add_listener(m_wl_*, ...) which
page-faults at null+8 (write to proxy->object.implementation).

FIX (kded6): wrapper script renames libqwayland.so to .disabled
before launching kded6.real. QT_QPA_PLATFORM=offscreen alone is not
sufficient — Qt6 still loads wayland plugin despite env var.

FIX (libwayland): null guards in redox.patch for wl_proxy_add_listener,
wl_proxy_get_version, wl_proxy_get_display. Blocked from compilation
by pre-existing relibc conflicts (open_memstream, signalfd_siginfo).

FIX (Qt6 wrappers): regex-based null guard insertion proven in concept.
Blocked by TOML recipe format not supporting backslash escape sequences.
Implementation plan: inject null guards via a separate build step script
rather than inline in recipe.toml.
This commit is contained in:
2026-05-06 16:34:46 +01:00
parent 8c51508362
commit 36c8c3d95a
37 changed files with 1057 additions and 321 deletions
+5 -28
View File
@@ -1,9 +1,8 @@
#TODO: Requires a narrow Redox delta for native scanner discovery during
# cross-builds and a userspace eventfd fallback because relibc lacks sys/eventfd.h.
# redox.patch keeps only the active scanner/eventfd compatibility surface.
#TODO: Requires Redox compatibility patching for missing Linux header paths and
# some POSIX/Linux-only flags during cross-builds.
# redox.patch restores the Redox compatibility stubs plus Meson scanner detection.
[source]
tar = "https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.24.0/downloads/wayland-1.24.0.tar.xz"
blake3 = "8c3b2bc792e5e262e9fb821fb8222b376de6fdf5d7af9b86d46e51ecf79704b9"
patches = ["redox.patch"]
[build]
@@ -15,30 +14,8 @@ dependencies = [
"libxml2",
]
script = """
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--disable-shared
--enable-static
)
COOKBOOK_MESON_FLAGS=(
--buildtype release
--wrap-mode nofallback
-Ddefault_library=static
-Dprefix=/usr
)
cookbook_meson \
-Ddocumentation=false \
-Dtests=false \
-Ddtd_validation=false \
-Dscanner=false \
-Dc_args="['-I${COOKBOOK_SYSROOT}/include','-Wno-error']"
for pc in "${COOKBOOK_STAGE}/usr/lib/pkgconfig/wayland-client.pc" "${COOKBOOK_STAGE}/usr/lib/pkgconfig/wayland-server.pc"; do
if [ -f "$pc" ]; then
sed -i 's/^Libs: /Libs: -lffi /' "$pc"
fi
done
DYNAMIC_INIT
cookbook_meson -Ddocumentation=false -Dtests=false -Ddtd_validation=false -Dc_args=-Wno-error
"""
[package]
@@ -649,6 +649,12 @@ WL_EXPORT int
wl_proxy_add_listener(struct wl_proxy *proxy,
void (**implementation)(void), void *data)
{
if (!proxy) {
fprintf(stderr, "FATAL: wl_proxy_add_listener(NULL) caller=%p -- returning error
",
__builtin_return_address(0));
return -1;
}
if (proxy->flags & WL_PROXY_FLAG_WRAPPER)
wl_abort("Proxy %p is a wrapper\n", proxy);
@@ -2442,6 +2448,7 @@ wl_proxy_get_user_data(struct wl_proxy *proxy)
WL_EXPORT uint32_t
wl_proxy_get_version(struct wl_proxy *proxy)
{
if (!proxy) return 0;
return proxy->version;
}
@@ -2560,6 +2567,7 @@ wl_proxy_get_interface(struct wl_proxy *proxy)
WL_EXPORT struct wl_display *
wl_proxy_get_display(struct wl_proxy *proxy)
{
if (!proxy) return NULL;
return proxy->display;
}