From 884ead03e1232b1f35c70098869cf9802f8ef836 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 23 Sep 2010 16:17:24 +0100 Subject: [PATCH] Add some more argument validation This is all internal, so we shouldn't need it; unfortunately, it seems we're passing invalid data internally, so for the time being catching inconsistencies should at least emit a warning for us to backtrace. --- clutter/clutter-private.h | 5 +++-- clutter/clutter-stage.c | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/clutter/clutter-private.h b/clutter/clutter-private.h index 56221c6..9bc987e 100644 --- a/clutter/clutter-private.h +++ b/clutter/clutter-private.h @@ -276,8 +276,9 @@ int _clutter_stage_get_pending_swaps (ClutterStage *stage); gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage); -void _clutter_stage_set_pick_buffer_valid (ClutterStage *stage, gboolean valid); -gboolean _clutter_stage_get_pick_buffer_valid (ClutterStage *stage); +void _clutter_stage_set_pick_buffer_valid (ClutterStage *stage, + gboolean valid); +gboolean _clutter_stage_get_pick_buffer_valid (ClutterStage *stage); void _clutter_stage_increment_picks_per_frame_counter (ClutterStage *stage); void _clutter_stage_reset_picks_per_frame_counter (ClutterStage *stage); guint _clutter_stage_get_picks_per_frame_counter (ClutterStage *stage); diff --git a/clutter/clutter-stage.c b/clutter/clutter-stage.c index 87ddc1d..0a8efd0 100644 --- a/clutter/clutter-stage.c +++ b/clutter/clutter-stage.c @@ -2949,29 +2949,40 @@ clutter_stage_get_no_clear_hint (ClutterStage *stage) gboolean _clutter_stage_get_pick_buffer_valid (ClutterStage *stage) { + g_return_val_if_fail (CLUTTER_IS_STAGE (stage), FALSE); + return stage->priv->have_valid_pick_buffer; } void -_clutter_stage_set_pick_buffer_valid (ClutterStage *stage, gboolean valid) +_clutter_stage_set_pick_buffer_valid (ClutterStage *stage, + gboolean valid) { - stage->priv->have_valid_pick_buffer = valid; + g_return_if_fail (CLUTTER_IS_STAGE (stage)); + + stage->priv->have_valid_pick_buffer = !!valid; } void _clutter_stage_increment_picks_per_frame_counter (ClutterStage *stage) { + g_return_if_fail (CLUTTER_IS_STAGE (stage)); + stage->priv->picks_per_frame++; } void _clutter_stage_reset_picks_per_frame_counter (ClutterStage *stage) { + g_return_if_fail (CLUTTER_IS_STAGE (stage)); + stage->priv->picks_per_frame = 0; } guint _clutter_stage_get_picks_per_frame_counter (ClutterStage *stage) { + g_return_val_if_fail (CLUTTER_IS_STAGE (stage), 0); + return stage->priv->picks_per_frame; } -- 2.7.4