From ad276865d2874b53311840eee79dd4d41ef2dc77 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sun, 29 Jan 2012 21:29:38 +0900 Subject: [PATCH] Fixed clutter_state_remove_key_internal() to propagate the is_inert state This was causing warnings when calling g_object_weak_unref on an already finalized object. https://bugzilla.gnome.org/show_bug.cgi?id=668951 --- clutter/clutter-state.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/clutter/clutter-state.c b/clutter/clutter-state.c index 6085b3a85..9c2db6de0 100644 --- a/clutter/clutter-state.c +++ b/clutter/clutter-state.c @@ -432,12 +432,15 @@ again_from_start: /* Go through each TargetState */ if (target_state) { - GList *k; -again_for_target_state: - for (k = target_state->keys; k != NULL; k = k->next) + GList *k = target_state->keys; + + /* Note the safe while() loop, because we modify the list inline */ + while (k != NULL) { ClutterStateKey *key = k->data; + k = k->next; + /* Check if each key matches query */ if ( (object == NULL || (object == key->object)) && (source_state == NULL || (source_state == key->source_state)) @@ -456,13 +459,12 @@ again_for_target_state: clutter_state_set_state (this, NULL); /* remove any keys that exist that uses this state as a source */ - clutter_state_remove_key (this, s->data, NULL, NULL, NULL); + clutter_state_remove_key_internal (this, s->data, NULL, NULL, NULL, is_inert); g_hash_table_remove (this->priv->states, s->data); goto again_from_start; /* we have just freed State *target_state, so need to restart removal */ } - goto again_for_target_state; } } }