From 3649795108f692327845753cf553029697aefbde Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 14 Jun 2018 12:38:27 +0200 Subject: [PATCH] wayland: Detach MetaWaylandActorSurface from its actor on dispose And ensure the actor is no longer reactive even though it might live longer because of close effects, GCs, and whatnot. This ensures the actor is not eligible for pointer picking within the destruction of its surface. Closes: #188 --- src/wayland/meta-wayland-actor-surface.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c index c0dc0c62b..ffa7b31e9 100644 --- a/src/wayland/meta-wayland-actor-surface.c +++ b/src/wayland/meta-wayland-actor-surface.c @@ -50,19 +50,23 @@ meta_wayland_actor_surface_constructed (GObject *object) } static void -meta_wayland_actor_surface_finalize (GObject *object) +meta_wayland_actor_surface_dispose (GObject *object) { MetaWaylandActorSurfacePrivate *priv = meta_wayland_actor_surface_get_instance_private (META_WAYLAND_ACTOR_SURFACE (object)); MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (object)); - g_signal_handlers_disconnect_by_func (priv->actor, - meta_wayland_surface_notify_geometry_changed, - surface); - g_object_unref (priv->actor); + if (priv->actor) + { + g_signal_handlers_disconnect_by_func (priv->actor, + meta_wayland_surface_notify_geometry_changed, + surface); + clutter_actor_set_reactive (CLUTTER_ACTOR (priv->actor), FALSE); + g_clear_object (&priv->actor); + } - G_OBJECT_CLASS (meta_wayland_actor_surface_parent_class)->finalize (object); + G_OBJECT_CLASS (meta_wayland_actor_surface_parent_class)->dispose (object); } static void @@ -270,7 +274,7 @@ meta_wayland_actor_surface_class_init (MetaWaylandActorSurfaceClass *klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->constructed = meta_wayland_actor_surface_constructed; - object_class->finalize = meta_wayland_actor_surface_finalize; + object_class->dispose = meta_wayland_actor_surface_dispose; surface_role_class->assigned = meta_wayland_actor_surface_assigned; surface_role_class->commit = meta_wayland_actor_surface_commit;