From bcd9a6dcec69cebaadd6aaeadd59b0ef7e785920 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Mon, 25 Feb 2008 12:24:56 +0000 Subject: [PATCH] 2008-02-25 Emmanuele Bassi * clutter/clutter-actor.c: Remove the usage of g_return_if_fail() from static functions: either assert or use g_warning() to check internal state, as g_return_if_fail() can be compiled out. * clutter/clutter-main.c: Ditto as above. --- ChangeLog | 8 ++++++++ clutter/clutter-actor.c | 12 ------------ clutter/clutter-main.c | 20 +++++++++++++++----- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bad73d32..f5437ae65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-02-25 Emmanuele Bassi + + * clutter/clutter-actor.c: Remove the usage of g_return_if_fail() + from static functions: either assert or use g_warning() to check + internal state, as g_return_if_fail() can be compiled out. + + * clutter/clutter-main.c: Ditto as above. + 2008-02-25 Tomas Frydrych * clutter/clutter-texture.c: diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 95e2b9885..9c3f940bf 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -605,8 +605,6 @@ clutter_actor_transform_point (ClutterActor *actor, ClutterFixed mtx[16]; ClutterActorPrivate *priv; - g_return_if_fail (CLUTTER_IS_ACTOR (actor)); - priv = actor->priv; cogl_push_matrix(); @@ -729,8 +727,6 @@ clutter_actor_transform_vertices_relative (ClutterActor *self, * Need to query coords here, so that we get coorect values for actors that * do not modify priv->coords. */ - g_return_if_fail (CLUTTER_IS_ACTOR (self)); - clutter_actor_query_coords (self, &coords); cogl_push_matrix(); @@ -806,8 +802,6 @@ clutter_actor_transform_vertices (ClutterActor *self, * Need to query coords here, so that we get coorect values for actors that * do not modify priv->coords. */ - g_return_if_fail (CLUTTER_IS_ACTOR (self)); - clutter_actor_query_coords (self, &coords); cogl_push_matrix(); @@ -2783,8 +2777,6 @@ clutter_actor_get_abs_position_units (ClutterActor *self, ClutterVertex v1; ClutterVertex v2; - g_return_if_fail (CLUTTER_IS_ACTOR (self)); - v1.x = v1.y = v1.z = 0; clutter_actor_apply_transform_to_point (self, &v1, &v2); @@ -5475,8 +5467,6 @@ clutter_actor_shader_pre_paint (ClutterActor *actor, ClutterShader *shader; ClutterMainContext *context; - g_return_if_fail (CLUTTER_IS_ACTOR (actor)); - priv = actor->priv; shader_data = priv->shader_data; @@ -5505,8 +5495,6 @@ clutter_actor_shader_post_paint (ClutterActor *actor) ClutterShader *shader; ClutterMainContext *context; - g_return_if_fail (CLUTTER_IS_ACTOR (actor)); - priv = actor->priv; shader_data = priv->shader_data; diff --git a/clutter/clutter-main.c b/clutter/clutter-main.c index 66e62f3c1..f848ff0d1 100644 --- a/clutter/clutter-main.c +++ b/clutter/clutter-main.c @@ -1182,10 +1182,17 @@ emit_event (ClutterEvent *event, ClutterActor *actor; gint i = 0, n_tree_events = 0; - g_return_if_fail (event->any.source != NULL); - g_return_if_fail (lock == FALSE); + if (!event->any.source) + { + g_warning ("No event source set, discarding event"); + return; + } - lock = TRUE; /* Guard against reentrancy */ + /* reentrancy check */ + if (lock == FALSE) + return; + + lock = TRUE; /* Sorry Mr Bassi. */ if (G_UNLIKELY (event_tree == NULL)) @@ -1390,10 +1397,13 @@ clutter_do_event (ClutterEvent *event) { actor = clutter_stage_get_key_focus (CLUTTER_STAGE (stage)); event->any.source = actor; - g_return_if_fail (actor != NULL); + if (G_UNLIKELY (actor == NULL)) + { + g_warning ("No key focus set, discarding"); + return; + } } - emit_keyboard_event (event); } break;