2008-02-25 Emmanuele Bassi <ebassi@openedhand.com>

* 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.
This commit is contained in:
Emmanuele Bassi 2008-02-25 12:24:56 +00:00
parent db5b80465a
commit bcd9a6dcec
3 changed files with 23 additions and 17 deletions

View File

@ -1,3 +1,11 @@
2008-02-25 Emmanuele Bassi <ebassi@openedhand.com>
* 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 <tf@openedhand.com> 2008-02-25 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-texture.c: * clutter/clutter-texture.c:

View File

@ -605,8 +605,6 @@ clutter_actor_transform_point (ClutterActor *actor,
ClutterFixed mtx[16]; ClutterFixed mtx[16];
ClutterActorPrivate *priv; ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = actor->priv; priv = actor->priv;
cogl_push_matrix(); 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 * Need to query coords here, so that we get coorect values for actors that
* do not modify priv->coords. * do not modify priv->coords.
*/ */
g_return_if_fail (CLUTTER_IS_ACTOR (self));
clutter_actor_query_coords (self, &coords); clutter_actor_query_coords (self, &coords);
cogl_push_matrix(); 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 * Need to query coords here, so that we get coorect values for actors that
* do not modify priv->coords. * do not modify priv->coords.
*/ */
g_return_if_fail (CLUTTER_IS_ACTOR (self));
clutter_actor_query_coords (self, &coords); clutter_actor_query_coords (self, &coords);
cogl_push_matrix(); cogl_push_matrix();
@ -2783,8 +2777,6 @@ clutter_actor_get_abs_position_units (ClutterActor *self,
ClutterVertex v1; ClutterVertex v1;
ClutterVertex v2; ClutterVertex v2;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
v1.x = v1.y = v1.z = 0; v1.x = v1.y = v1.z = 0;
clutter_actor_apply_transform_to_point (self, &v1, &v2); clutter_actor_apply_transform_to_point (self, &v1, &v2);
@ -5475,8 +5467,6 @@ clutter_actor_shader_pre_paint (ClutterActor *actor,
ClutterShader *shader; ClutterShader *shader;
ClutterMainContext *context; ClutterMainContext *context;
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = actor->priv; priv = actor->priv;
shader_data = priv->shader_data; shader_data = priv->shader_data;
@ -5505,8 +5495,6 @@ clutter_actor_shader_post_paint (ClutterActor *actor)
ClutterShader *shader; ClutterShader *shader;
ClutterMainContext *context; ClutterMainContext *context;
g_return_if_fail (CLUTTER_IS_ACTOR (actor));
priv = actor->priv; priv = actor->priv;
shader_data = priv->shader_data; shader_data = priv->shader_data;

View File

@ -1182,10 +1182,17 @@ emit_event (ClutterEvent *event,
ClutterActor *actor; ClutterActor *actor;
gint i = 0, n_tree_events = 0; gint i = 0, n_tree_events = 0;
g_return_if_fail (event->any.source != NULL); if (!event->any.source)
g_return_if_fail (lock == FALSE); {
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. */ /* Sorry Mr Bassi. */
if (G_UNLIKELY (event_tree == NULL)) if (G_UNLIKELY (event_tree == NULL))
@ -1390,10 +1397,13 @@ clutter_do_event (ClutterEvent *event)
{ {
actor = clutter_stage_get_key_focus (CLUTTER_STAGE (stage)); actor = clutter_stage_get_key_focus (CLUTTER_STAGE (stage));
event->any.source = actor; 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); emit_keyboard_event (event);
} }
break; break;