From 13ac1fe75bec418f4e37e04540e6d16af55413f5 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 7 Oct 2009 11:31:44 +0100 Subject: [PATCH] [clutter-id-pool] Also warn if the ID refers to a deleted actor We should also warn if the glReadPixels happens to generate an ID that is within the range of the ID array but no longer points to an existing actor. --- clutter/clutter-id-pool.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/clutter/clutter-id-pool.c b/clutter/clutter-id-pool.c index c5ecc5949..7527ad0e8 100644 --- a/clutter/clutter-id-pool.c +++ b/clutter/clutter-id-pool.c @@ -115,16 +115,16 @@ clutter_id_pool_lookup (ClutterIDPool *id_pool, g_return_val_if_fail (id_pool != NULL, NULL); g_return_val_if_fail (id_pool->array != NULL, NULL); - if (id >= id_pool->array->len) + array = (void*) id_pool->array->data; + + if (id >= id_pool->array->len || array[id] == NULL) { - g_warning ("The required ID of %u is outside the ID range; this " - "usually implies that the pick() of an actor is not " + g_warning ("The required ID of %u does not refer to an existing actor; " + "this usually implies that the pick() of an actor is not " "correctly implemented or that there is an error in the " "glReadPixels() implementation of the GL driver.", id); return NULL; } - array = (void*) id_pool->array->data; - return array[id]; }