Do not use set_parent()/unparent() internally
Use add_child()/remove_child() instead.
This commit is contained in:
parent
53aa64aeb9
commit
8462b5ba45
@ -3746,7 +3746,7 @@ clutter_actor_dispose (GObject *object)
|
||||
clutter_container_remove_actor (CLUTTER_CONTAINER (parent), self);
|
||||
}
|
||||
else
|
||||
clutter_actor_unparent (self);
|
||||
clutter_actor_remove_child (parent, self);
|
||||
}
|
||||
|
||||
/* parent should be gone */
|
||||
@ -8259,8 +8259,8 @@ clutter_actor_add_child (ClutterActor *self,
|
||||
|
||||
if (child->priv->parent_actor != NULL)
|
||||
{
|
||||
g_warning ("Cannot set a parent on an actor which has a parent.\n"
|
||||
"You must use clutter_actor_unparent() first.\n");
|
||||
g_warning ("Cannot set a parent on an actor which has a parent. "
|
||||
"You must use clutter_actor_remove_child() first.");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -8542,19 +8542,19 @@ clutter_actor_reparent (ClutterActor *self,
|
||||
if (CLUTTER_IS_CONTAINER (priv->parent_actor) &&
|
||||
!CLUTTER_ACTOR_IS_INTERNAL_CHILD (self))
|
||||
{
|
||||
ClutterContainer *parent = CLUTTER_CONTAINER (priv->parent_actor);
|
||||
ClutterContainer *parent = CLUTTER_CONTAINER (old_parent);
|
||||
|
||||
/* this will have to call unparent() */
|
||||
clutter_container_remove_actor (parent, self);
|
||||
}
|
||||
else
|
||||
clutter_actor_unparent (self);
|
||||
clutter_actor_remove_child (old_parent, self);
|
||||
|
||||
/* Note, will call parent() */
|
||||
if (CLUTTER_IS_CONTAINER (new_parent))
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (new_parent), self);
|
||||
else
|
||||
clutter_actor_set_parent (self, new_parent);
|
||||
clutter_actor_add_child (new_parent, self);
|
||||
|
||||
/* we emit the ::parent-set signal once */
|
||||
g_signal_emit (self, actor_signals[PARENT_SET], 0, old_parent);
|
||||
|
@ -165,7 +165,7 @@ clutter_box_real_add (ClutterContainer *container,
|
||||
else
|
||||
priv->children = l;
|
||||
|
||||
clutter_actor_set_parent (actor, CLUTTER_ACTOR (container));
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (container), actor);
|
||||
|
||||
clutter_actor_queue_relayout (actor);
|
||||
|
||||
@ -183,7 +183,7 @@ clutter_box_real_remove (ClutterContainer *container,
|
||||
g_object_ref (actor);
|
||||
|
||||
priv->children = g_list_remove (priv->children, actor);
|
||||
clutter_actor_unparent (actor);
|
||||
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
|
||||
|
||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (container));
|
||||
|
||||
@ -974,7 +974,7 @@ clutter_box_pack_at (ClutterBox *box,
|
||||
actor,
|
||||
position);
|
||||
|
||||
clutter_actor_set_parent (actor, CLUTTER_ACTOR (box));
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (box), actor);
|
||||
clutter_actor_queue_relayout (actor);
|
||||
|
||||
/* we need to explicitly call this, because we're not going through
|
||||
|
@ -111,7 +111,7 @@ clutter_group_real_add (ClutterContainer *container,
|
||||
g_object_ref (actor);
|
||||
|
||||
priv->children = g_list_append (priv->children, actor);
|
||||
clutter_actor_set_parent (actor, CLUTTER_ACTOR (container));
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (container), actor);
|
||||
|
||||
/* queue a relayout, to get the correct positioning inside
|
||||
* the ::actor-added signal handlers
|
||||
@ -134,7 +134,7 @@ clutter_group_real_remove (ClutterContainer *container,
|
||||
g_object_ref (actor);
|
||||
|
||||
priv->children = g_list_remove (priv->children, actor);
|
||||
clutter_actor_unparent (actor);
|
||||
clutter_actor_remove_child (CLUTTER_ACTOR (container), actor);
|
||||
|
||||
/* queue a relayout, to get the correct positioning inside
|
||||
* the ::actor-removed signal handlers
|
||||
|
@ -2386,12 +2386,14 @@ on_fbo_parent_change (ClutterActor *actor,
|
||||
ClutterActor *parent = CLUTTER_ACTOR(texture);
|
||||
|
||||
while ((parent = clutter_actor_get_parent (parent)) != NULL)
|
||||
if (parent == actor)
|
||||
{
|
||||
g_warning ("Offscreen texture is ancestor of source!");
|
||||
/* Desperate but will avoid infinite loops */
|
||||
clutter_actor_unparent (actor);
|
||||
}
|
||||
{
|
||||
if (parent == actor)
|
||||
{
|
||||
g_warning ("Offscreen texture is ancestor of source!");
|
||||
/* Desperate but will avoid infinite loops */
|
||||
clutter_actor_remove_child (parent, actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2544,7 +2546,7 @@ clutter_texture_new_from_actor (ClutterActor *actor)
|
||||
/* If the actor doesn't have a parent then claim it so that it will
|
||||
get a size allocation during layout */
|
||||
if (clutter_actor_get_parent (actor) == NULL)
|
||||
clutter_actor_set_parent (actor, CLUTTER_ACTOR (texture));
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (texture), actor);
|
||||
|
||||
/* Connect up any signals which could change our underlying size */
|
||||
g_signal_connect (actor,
|
||||
@ -2606,11 +2608,14 @@ texture_fbo_free_resources (ClutterTexture *texture)
|
||||
|
||||
if (priv->fbo_source != NULL)
|
||||
{
|
||||
ClutterActor *parent;
|
||||
|
||||
parent = clutter_actor_get_parent (priv->fbo_source);
|
||||
|
||||
/* If we parented the texture then unparent it again so that it
|
||||
will lose the reference */
|
||||
if (clutter_actor_get_parent (priv->fbo_source)
|
||||
== CLUTTER_ACTOR (texture))
|
||||
clutter_actor_unparent (priv->fbo_source);
|
||||
if (parent == CLUTTER_ACTOR (texture))
|
||||
clutter_actor_remove_child (parent, priv->fbo_source);
|
||||
|
||||
g_signal_handlers_disconnect_by_func
|
||||
(priv->fbo_source,
|
||||
|
Loading…
Reference in New Issue
Block a user