summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2023-05-09 14:34:51 +0200
committerMarge Bot <marge-bot@gnome.org>2023-05-09 15:26:32 +0000
commit1a4f03bd79a2ba502dbd6a932ec20a73921d6709 (patch)
tree12d6f12b30d145ebfddd99a3e9f12d03db808c09
parent802c1baec742f467ab2da9a9c6f648dc4d921d69 (diff)
downloadmutter-1a4f03bd79a2ba502dbd6a932ec20a73921d6709.tar.gz
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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2992>
-rw-r--r--src/wayland/meta-wayland-surface.c3
1 files changed, 3 insertions, 0 deletions
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);