From 91126558d35c58a94f674ad93d9561e4c5ab3bff Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 8 May 2009 17:14:49 +0100 Subject: [PATCH] [actor] Relax some of the invariants checks When destroying a top-level actor we can actually relax the verification of the map state, since it might be fully asynchronous and we might not re-enter inside the mainloop in time to receive the unmap notification. --- clutter/clutter-actor.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 1ce681583..ef6d0d662 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -558,8 +558,11 @@ clutter_actor_verify_map_state (ClutterActor *self) { if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) { - if (!CLUTTER_ACTOR_IS_VISIBLE (self)) - g_warning ("Toplevel actor is mapped but not visible"); + if (!CLUTTER_ACTOR_IS_VISIBLE (self) && + !(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_DESTRUCTION)) + { + g_warning ("Toplevel actor is mapped but not visible"); + } } else { @@ -690,7 +693,9 @@ clutter_actor_update_map_state (ClutterActor *self, break; } - if (CLUTTER_ACTOR_IS_MAPPED (self) && !CLUTTER_ACTOR_IS_VISIBLE (self)) + if (CLUTTER_ACTOR_IS_MAPPED (self) && + !CLUTTER_ACTOR_IS_VISIBLE (self) && + !(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IN_DESTRUCTION)) { g_warning ("Clutter toplevel is not visible, but is " "somehow still mapped"); @@ -1139,7 +1144,7 @@ clutter_actor_realize (ClutterActor *self) /* To be realized, our parent actors must be realized first. * This will only succeed if we're inside a toplevel. */ - if (self->priv->parent_actor) + if (self->priv->parent_actor != NULL) clutter_actor_realize (self->priv->parent_actor); if (CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL) @@ -2820,9 +2825,13 @@ clutter_actor_dispose (GObject *object) /* parent should be gone */ g_assert (priv->parent_actor == NULL); - /* can't be mapped or realized with no parent */ - g_assert (!CLUTTER_ACTOR_IS_MAPPED (self)); - g_assert (!CLUTTER_ACTOR_IS_REALIZED (self)); + + if (!(CLUTTER_PRIVATE_FLAGS (self) & CLUTTER_ACTOR_IS_TOPLEVEL)) + { + /* can't be mapped or realized with no parent */ + g_assert (!CLUTTER_ACTOR_IS_MAPPED (self)); + g_assert (!CLUTTER_ACTOR_IS_REALIZED (self)); + } destroy_shader_data (self);