Merge branch 'wip/fix-transitions-leak' into 'master'
clutter/actor: Mark implicit transitions as remove-on-complete See merge request GNOME/clutter!11
This commit is contained in:
commit
e7db0571fa
|
@ -1015,7 +1015,6 @@ typedef struct _TransitionClosure
|
|||
ClutterTransition *transition;
|
||||
gchar *name;
|
||||
gulong completed_id;
|
||||
guint is_implicit : 1;
|
||||
} TransitionClosure;
|
||||
|
||||
static void clutter_container_iface_init (ClutterContainerIface *iface);
|
||||
|
@ -4090,11 +4089,7 @@ _clutter_actor_stop_transitions (ClutterActor *self)
|
|||
{
|
||||
TransitionClosure *closure = value;
|
||||
|
||||
/* implicit transitions, and automatically managed explicit ones,
|
||||
* should be removed at this point
|
||||
*/
|
||||
if (closure->is_implicit ||
|
||||
clutter_transition_get_remove_on_complete (closure->transition))
|
||||
if (clutter_transition_get_remove_on_complete (closure->transition))
|
||||
{
|
||||
g_hash_table_iter_remove (&iter);
|
||||
}
|
||||
|
@ -19049,12 +19044,12 @@ on_transition_stopped (ClutterTransition *transition,
|
|||
t_quark = g_quark_from_string (clos->name);
|
||||
t_name = g_strdup (clos->name);
|
||||
|
||||
if (clos->is_implicit ||
|
||||
clutter_transition_get_remove_on_complete (transition))
|
||||
if (clutter_transition_get_remove_on_complete (transition))
|
||||
{
|
||||
/* we take a reference here because removing the closure
|
||||
* will release the reference on the transition, and we
|
||||
* want the transition to survive the signal emission
|
||||
/* we take a reference here because removing the closure will release the
|
||||
* reference on the transition, and we want the transition to survive the
|
||||
* signal emission. It'll be unreferenced by the remove-on-complete
|
||||
* handling in ClutterTransition::stopped.
|
||||
*/
|
||||
g_object_ref (transition);
|
||||
|
||||
|
@ -19093,8 +19088,7 @@ on_transition_stopped (ClutterTransition *transition,
|
|||
static void
|
||||
clutter_actor_add_transition_internal (ClutterActor *self,
|
||||
const gchar *name,
|
||||
ClutterTransition *transition,
|
||||
gboolean is_implicit)
|
||||
ClutterTransition *transition)
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
TransitionClosure *clos;
|
||||
|
@ -19124,7 +19118,6 @@ clutter_actor_add_transition_internal (ClutterActor *self,
|
|||
clos->actor = self;
|
||||
clos->transition = g_object_ref (transition);
|
||||
clos->name = g_strdup (name);
|
||||
clos->is_implicit = is_implicit;
|
||||
clos->completed_id = g_signal_connect (timeline, "stopped",
|
||||
G_CALLBACK (on_transition_stopped),
|
||||
clos);
|
||||
|
@ -19283,6 +19276,8 @@ _clutter_actor_create_transition (ClutterActor *actor,
|
|||
{
|
||||
res = clutter_property_transition_new (pspec->name);
|
||||
|
||||
clutter_transition_set_remove_on_complete (res, TRUE);
|
||||
|
||||
interval = clutter_interval_new_with_values (ptype, &initial, &final);
|
||||
clutter_transition_set_interval (res, interval);
|
||||
|
||||
|
@ -19316,7 +19311,7 @@ _clutter_actor_create_transition (ClutterActor *actor,
|
|||
#endif /* CLUTTER_ENABLE_DEBUG */
|
||||
|
||||
/* this will start the transition as well */
|
||||
clutter_actor_add_transition_internal (actor, pspec->name, res, TRUE);
|
||||
clutter_actor_add_transition_internal (actor, pspec->name, res);
|
||||
|
||||
/* the actor now owns the transition */
|
||||
g_object_unref (res);
|
||||
|
@ -19390,7 +19385,7 @@ clutter_actor_add_transition (ClutterActor *self,
|
|||
g_return_if_fail (name != NULL);
|
||||
g_return_if_fail (CLUTTER_IS_TRANSITION (transition));
|
||||
|
||||
clutter_actor_add_transition_internal (self, name, transition, FALSE);
|
||||
clutter_actor_add_transition_internal (self, name, transition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue