diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2016-03-29 15:04:50 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2016-03-29 15:09:26 +0100 |
commit | c6e40de500534df321d2150229a16215054fce38 (patch) | |
tree | 29d36b5c41f900deacd50a9d7cb9fe012ccbaac7 | |
parent | c1818efb18edac10ef06f25e717f9591f44fd226 (diff) | |
download | clutter-c6e40de500534df321d2150229a16215054fce38.tar.gz |
actor: Warn on adding/removing itself as a child
ClutterActor should warn if a user tries to add or remove an actor to,
and from, itself on the scene graph.
Clutter will likely crash, or warn way down the line, but if we can make
debugging simpler then we should.
-rw-r--r-- | clutter/clutter-actor.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index d966e40c6..fedcbfe09 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -4198,6 +4198,13 @@ clutter_actor_remove_child_internal (ClutterActor *self, gboolean stop_transitions; GObject *obj; + if (self == child) + { + g_warning ("Cannot remove actor '%s' from itself.", + _clutter_actor_get_debug_name (self)); + return; + } + destroy_meta = (flags & REMOVE_CHILD_DESTROY_META) != 0; emit_parent_set = (flags & REMOVE_CHILD_EMIT_PARENT_SET) != 0; emit_actor_removed = (flags & REMOVE_CHILD_EMIT_ACTOR_REMOVED) != 0; @@ -12777,6 +12784,13 @@ clutter_actor_add_child_internal (ClutterActor *self, ClutterActor *old_first_child, *old_last_child; GObject *obj; + if (self == child) + { + g_warning ("Cannot add the actor '%s' to itself.", + _clutter_actor_get_debug_name (self)); + return; + } + if (child->priv->parent != NULL) { g_warning ("The actor '%s' already has a parent, '%s'. You must " |