diagnostic: add null guard to wl_proxy_add_listener + bind tracing

- libwayland: fprintf+abort if wl_proxy_add_listener called with NULL proxy.
  Prints caller address via __builtin_return_address(0) to identify
  which Qt6 function passes the null proxy.
- compositor: eprintln each wl_registry_bind to show which globals
  Qt6 binds before crashing.
- Next boot will definitively identify the crash source.
This commit is contained in:
2026-05-06 13:34:33 +01:00
parent 6a5f569a27
commit cbc0b815f7
2 changed files with 14 additions and 4 deletions
@@ -646,10 +646,15 @@ wl_proxy_destroy(struct wl_proxy *proxy)
* \memberof wl_proxy * \memberof wl_proxy
*/ */
WL_EXPORT int WL_EXPORT int
wl_proxy_add_listener(struct wl_proxy *proxy, wl_proxy_add_listener(struct wl_proxy *proxy,
void (**implementation)(void), void *data) void (**implementation)(void), void *data)
{ {
if (proxy->flags & WL_PROXY_FLAG_WRAPPER) + if (!proxy) {
+ fprintf(stderr, "FATAL: wl_proxy_add_listener(NULL) — caller=%p impl=%p\n",
+ __builtin_return_address(0), (void*)implementation);
+ abort();
+ }
if (proxy->flags & WL_PROXY_FLAG_WRAPPER)
wl_abort("Proxy %p is a wrapper\n", proxy); wl_abort("Proxy %p is a wrapper\n", proxy);
if (proxy->object.implementation || proxy->dispatcher) { if (proxy->object.implementation || proxy->dispatcher) {
@@ -728,6 +728,11 @@ impl Compositor {
let _version = read_u32(payload, &mut cursor)?; let _version = read_u32(payload, &mut cursor)?;
let new_id = read_u32(payload, &mut cursor)?; let new_id = read_u32(payload, &mut cursor)?;
eprintln!(
"redbear-compositor: client {} binds '{}' -> id {}",
client_id, iface, new_id
);
let mut clients = self.clients.lock().unwrap(); let mut clients = self.clients.lock().unwrap();
if let Some(client) = clients.get_mut(&client_id) { if let Some(client) = clients.get_mut(&client_id) {
let type_id = match iface.as_str() { let type_id = match iface.as_str() {