From 092b3edb51030c86bd7c1a3c040fe6cfabe7772c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 3 Oct 2019 21:41:48 +0200 Subject: [PATCH] wayland/actor-surface: Add actor clear helper No functional changes. https://gitlab.gnome.org/GNOME/mutter/merge_requests/825 --- src/wayland/meta-wayland-actor-surface.c | 34 ++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c index 59c2e5274..5e8cd09b9 100644 --- a/src/wayland/meta-wayland-actor-surface.c +++ b/src/wayland/meta-wayland-actor-surface.c @@ -51,20 +51,32 @@ meta_wayland_actor_surface_constructed (GObject *object) } static void -meta_wayland_actor_surface_dispose (GObject *object) +clear_surface_actor (MetaWaylandActorSurface *actor_surface) { MetaWaylandActorSurfacePrivate *priv = - meta_wayland_actor_surface_get_instance_private (META_WAYLAND_ACTOR_SURFACE (object)); + meta_wayland_actor_surface_get_instance_private (actor_surface); + MetaWaylandSurfaceRole *surface_role = + META_WAYLAND_SURFACE_ROLE (actor_surface); MetaWaylandSurface *surface = - meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (object)); + meta_wayland_surface_role_get_surface (surface_role); + + g_signal_handlers_disconnect_by_func (priv->actor, + meta_wayland_surface_notify_geometry_changed, + surface); + g_clear_object (&priv->actor); +} + +static void +meta_wayland_actor_surface_dispose (GObject *object) +{ + MetaWaylandActorSurface *actor_surface = META_WAYLAND_ACTOR_SURFACE (object); + MetaWaylandActorSurfacePrivate *priv = + meta_wayland_actor_surface_get_instance_private (actor_surface); 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); + clear_surface_actor (actor_surface); } G_OBJECT_CLASS (meta_wayland_actor_surface_parent_class)->dispose (object); @@ -300,13 +312,7 @@ meta_wayland_actor_surface_reset_actor (MetaWaylandActorSurface *actor_surface) MetaWaylandSurface *surface = meta_wayland_surface_role_get_surface (META_WAYLAND_SURFACE_ROLE (actor_surface)); - if (priv->actor) - { - g_signal_handlers_disconnect_by_func (priv->actor, - meta_wayland_surface_notify_geometry_changed, - surface); - g_object_unref (priv->actor); - } + clear_surface_actor (actor_surface); priv->actor = g_object_ref_sink (meta_surface_actor_wayland_new (surface));