Blame SOURCES/0001-cally-Fix-state-set-leak.patch

79df40
From f5c5f62d9f820b56e81f8b3829aae8195841c755 Mon Sep 17 00:00:00 2001
79df40
From: Ray Strode <rstrode@redhat.com>
79df40
Date: Thu, 30 Apr 2020 10:23:09 -0400
79df40
Subject: [PATCH 1/4] cally: Fix state set leak
79df40
79df40
cally_actor_action_do_action leaks a state set object in the
79df40
case where the actor is defunct, insensitive, or hidden.
79df40
79df40
This commit plugs the leak.
79df40
79df40
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1225
79df40
---
79df40
 clutter/clutter/cally/cally-actor.c | 17 ++++++++++-------
79df40
 1 file changed, 10 insertions(+), 7 deletions(-)
79df40
79df40
diff --git a/clutter/clutter/cally/cally-actor.c b/clutter/clutter/cally/cally-actor.c
79df40
index 77195c0b0..ff6dba14e 100644
79df40
--- a/clutter/clutter/cally/cally-actor.c
79df40
+++ b/clutter/clutter/cally/cally-actor.c
79df40
@@ -797,92 +797,95 @@ _cally_actor_get_top_level_origin (ClutterActor *actor,
79df40
 
79df40
   if (xp)
79df40
     *xp = x;
79df40
 
79df40
   if (yp)
79df40
     *yp = y;
79df40
 }
79df40
 
79df40
 /* AtkAction implementation */
79df40
 static void
79df40
 cally_actor_action_interface_init (AtkActionIface *iface)
79df40
 {
79df40
   g_return_if_fail (iface != NULL);
79df40
 
79df40
   iface->do_action       = cally_actor_action_do_action;
79df40
   iface->get_n_actions   = cally_actor_action_get_n_actions;
79df40
   iface->get_description = cally_actor_action_get_description;
79df40
   iface->get_keybinding  = cally_actor_action_get_keybinding;
79df40
   iface->get_name        = cally_actor_action_get_name;
79df40
   iface->set_description = cally_actor_action_set_description;
79df40
 }
79df40
 
79df40
 static gboolean
79df40
 cally_actor_action_do_action (AtkAction *action,
79df40
                              gint       index)
79df40
 {
79df40
   CallyActor           *cally_actor = NULL;
79df40
   AtkStateSet          *set         = NULL;
79df40
   CallyActorPrivate    *priv        = NULL;
79df40
   CallyActorActionInfo *info        = NULL;
79df40
+  gboolean              did_action  = FALSE;
79df40
 
79df40
   cally_actor = CALLY_ACTOR (action);
79df40
   priv = cally_actor->priv;
79df40
 
79df40
   set = atk_object_ref_state_set (ATK_OBJECT (cally_actor));
79df40
 
79df40
   if (atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
79df40
-    return FALSE;
79df40
+    goto out;
79df40
 
79df40
   if (!atk_state_set_contains_state (set, ATK_STATE_SENSITIVE) ||
79df40
       !atk_state_set_contains_state (set, ATK_STATE_SHOWING))
79df40
-    return FALSE;
79df40
-
79df40
-  g_object_unref (set);
79df40
+    goto out;
79df40
 
79df40
   info = _cally_actor_get_action_info (cally_actor, index);
79df40
 
79df40
   if (info == NULL)
79df40
-    return FALSE;
79df40
+    goto out;
79df40
 
79df40
   if (info->do_action_func == NULL)
79df40
-    return FALSE;
79df40
+    goto out;
79df40
 
79df40
   if (!priv->action_queue)
79df40
     priv->action_queue = g_queue_new ();
79df40
 
79df40
   g_queue_push_head (priv->action_queue, info);
79df40
 
79df40
   if (!priv->action_idle_handler)
79df40
     priv->action_idle_handler = g_idle_add (idle_do_action, cally_actor);
79df40
 
79df40
-  return TRUE;
79df40
+  did_action = TRUE;
79df40
+
79df40
+out:
79df40
+  g_clear_object (&set);
79df40
+  return did_action;
79df40
 }
79df40
 
79df40
 static gboolean
79df40
 idle_do_action (gpointer data)
79df40
 {
79df40
   CallyActor        *cally_actor = NULL;
79df40
   CallyActorPrivate *priv       = NULL;
79df40
   ClutterActor     *actor      = NULL;
79df40
 
79df40
   cally_actor = CALLY_ACTOR (data);
79df40
   priv = cally_actor->priv;
79df40
   actor = CALLY_GET_CLUTTER_ACTOR (cally_actor);
79df40
   priv->action_idle_handler = 0;
79df40
 
79df40
   if (actor == NULL) /* state is defunct*/
79df40
     return FALSE;
79df40
 
79df40
   while (!g_queue_is_empty (priv->action_queue))
79df40
     {
79df40
       CallyActorActionInfo *info = NULL;
79df40
 
79df40
       info = (CallyActorActionInfo *) g_queue_pop_head (priv->action_queue);
79df40
 
79df40
       info->do_action_func (cally_actor, info->user_data);
79df40
     }
79df40
 
79df40
   return FALSE;
79df40
 }
79df40
 
79df40
 static gint
79df40
-- 
79df40
2.26.2
79df40