From 1a4f03bd79a2ba502dbd6a932ec20a73921d6709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 9 May 2023 14:34:51 +0200 Subject: wayland/surface: NULL check surface resource in handle_output_bound() Otherwise binding new wl_output's might try to send enter to the destroyed resource. Fixes the following crash: #0 wl_resource_get_client at ../src/wayland-server.c:801 #1 handle_output_bound at ../src/wayland/meta-wayland-surface.c:1287 #3 signal_emit_unlocked_R.isra.0 at ../gobject/gsignal.c:3812 #6 ffi_call_unix64 at ../src/x86/unix64.S:104 #7 ffi_call_int at ../src/x86/ffi64.c:673 #8 ffi_call at ../src/x86/ffi64.c:710 #9 wl_closure_invoke at ../src/connection.c:1025 #10 wl_client_connection_data at ../src/wayland-server.c:438 #11 wl_event_loop_dispatch at ../src/event-loop.c:1027 #12 wayland_event_source_dispatch at ../src/wayland/meta-wayland.c:125 #15 g_main_context_iterate.isra.0 at ../glib/gmain.c:4276 #17 meta_context_run_main_loop at ../src/core/meta-context.c:482 Related: https://bugzilla.redhat.com/show_bug.cgi?id=2196527 Part-of: --- src/wayland/meta-wayland-surface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 73aeb18ba..abd5dae15 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -1283,6 +1283,9 @@ handle_output_bound (MetaWaylandOutput *wayland_output, struct wl_resource *output_resource, MetaWaylandSurface *surface) { + if (!surface->resource) + return; + if (wl_resource_get_client (output_resource) == wl_resource_get_client (surface->resource)) wl_surface_send_enter (surface->resource, output_resource); -- cgit v1.2.1