summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2023-05-09 14:34:51 +0200
committerJonas Ådahl <jadahl@gmail.com>2023-05-09 15:30:21 -0400
commitcee3d72b1e7dc974eb75c89128c36dbf821cb64a (patch)
tree5798d2dbdd28a43a8e3c8e50a6885272a5a3b3c8
parentebda0304e1120d714851a3cc6de605b2afd71ef5 (diff)
downloadmutter-cee3d72b1e7dc974eb75c89128c36dbf821cb64a.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> (cherry picked from commit 1a4f03bd79a2ba502dbd6a932ec20a73921d6709)
-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);