summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2020-04-30 14:23:09 +0000
committerJonas Ã…dahl <jadahl@gmail.com>2020-10-15 09:37:23 +0000
commitb99490ed3cf39f27299479ed8d026d2ba8f51357 (patch)
tree3bdc80110a7404423cde787539413be258910967
parent5703a56996ab8ef4214678ac18ecaf9ffdc2077a (diff)
downloadmutter-cherry-pick-79e5ec57-5.tar.gz
cally: fix state set leakcherry-pick-79e5ec57-5
cally_actor_action_do_action leaks a state set object in the case where the actor is defunct, insensitive, or hidden. This commit plugs the leak. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1225 (cherry picked from commit 79e5ec57d24f1650cdb2f23e68c9f8bf6a494283)
-rw-r--r--clutter/clutter/cally/cally-actor.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/clutter/clutter/cally/cally-actor.c b/clutter/clutter/cally/cally-actor.c
index f341d3616..26327ad96 100644
--- a/clutter/clutter/cally/cally-actor.c
+++ b/clutter/clutter/cally/cally-actor.c
@@ -819,10 +819,11 @@ static gboolean
cally_actor_action_do_action (AtkAction *action,
gint index)
{
- CallyActor *cally_actor = NULL;
- AtkStateSet *set = NULL;
- CallyActorPrivate *priv = NULL;
- CallyActorActionInfo *info = NULL;
+ CallyActor *cally_actor = NULL;
+ AtkStateSet *set = NULL;
+ CallyActorPrivate *priv = NULL;
+ CallyActorActionInfo *info = NULL;
+ gboolean did_action = FALSE;
cally_actor = CALLY_ACTOR (action);
priv = cally_actor->priv;
@@ -830,21 +831,19 @@ cally_actor_action_do_action (AtkAction *action,
set = atk_object_ref_state_set (ATK_OBJECT (cally_actor));
if (atk_state_set_contains_state (set, ATK_STATE_DEFUNCT))
- return FALSE;
+ goto out;
if (!atk_state_set_contains_state (set, ATK_STATE_SENSITIVE) ||
!atk_state_set_contains_state (set, ATK_STATE_SHOWING))
- return FALSE;
-
- g_object_unref (set);
+ goto out;
info = _cally_actor_get_action_info (cally_actor, index);
if (info == NULL)
- return FALSE;
+ goto out;
if (info->do_action_func == NULL)
- return FALSE;
+ goto out;
if (!priv->action_queue)
priv->action_queue = g_queue_new ();
@@ -854,7 +853,12 @@ cally_actor_action_do_action (AtkAction *action,
if (!priv->action_idle_handler)
priv->action_idle_handler = g_idle_add (idle_do_action, cally_actor);
- return TRUE;
+ did_action = TRUE;
+
+out:
+ g_clear_object (&set);
+
+ return did_action;
}
static gboolean