From 8d2a3d608869ef09aff42db7bc537ae927f8d1c1 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 7 Sep 2010 22:02:23 +0100 Subject: [PATCH] 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. --- clutter/clutter-actor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 7ab07b836..7706cf6cf 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -5282,6 +5282,13 @@ clutter_actor_allocate (ClutterActor *self, gboolean child_moved; 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;