From 212283c13b5db8d2fccc0e970c8cc198a1c89c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 6 Dec 2023 15:34:47 +0100 Subject: [PATCH] wayland/idle-inhibit: Handle NULL inhibitor->actor Fixes: a3c62bf8aa7a ("wayland/idle-inhibit: Add state tracking to fix races") Part-of: --- src/wayland/meta-wayland-idle-inhibit.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/wayland/meta-wayland-idle-inhibit.c b/src/wayland/meta-wayland-idle-inhibit.c index bf9c1fa19..b2931c8f9 100644 --- a/src/wayland/meta-wayland-idle-inhibit.c +++ b/src/wayland/meta-wayland-idle-inhibit.c @@ -291,12 +291,16 @@ static void attach_actor (MetaWaylandIdleInhibitor *inhibitor) { inhibitor->actor = meta_wayland_surface_get_actor (inhibitor->surface); - inhibitor->is_obscured_changed_handler = - g_signal_connect (inhibitor->actor, "notify::is-obscured", - G_CALLBACK (is_obscured_changed), inhibitor); - inhibitor->actor_destroyed_handler_id = - g_signal_connect (inhibitor->actor, "destroy", - G_CALLBACK (on_actor_destroyed), inhibitor); + + if (inhibitor->actor) + { + inhibitor->is_obscured_changed_handler = + g_signal_connect (inhibitor->actor, "notify::is-obscured", + G_CALLBACK (is_obscured_changed), inhibitor); + inhibitor->actor_destroyed_handler_id = + g_signal_connect (inhibitor->actor, "destroy", + G_CALLBACK (on_actor_destroyed), inhibitor); + } } static void