actor: warn if allocating actor not descending from stage

This adds a verbose warning that will be displayed if
clutter_actor_allocate is passed an actor that isn't a descendent of a
ClutterStage. Layouting should always bubble up from a stage so this
condition is likely to indicate a buggy container that allocating a
child that it has already unparented.
This commit is contained in:
Robert Bragg 2010-09-07 22:02:23 +01:00
parent ff4c24f0a4
commit 8d2a3d6088

View File

@ -5282,6 +5282,13 @@ clutter_actor_allocate (ClutterActor *self,
gboolean child_moved; gboolean child_moved;
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
if (G_UNLIKELY (_clutter_actor_get_stage_internal (self) == NULL))
{
g_warning ("Spurious clutter_actor_allocate called for actor %p/%s "
"which isn't a descendent of the stage!\n",
self, G_OBJECT_TYPE_NAME (self));
return;
}
priv = self->priv; priv = self->priv;