[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.
This commit is contained in:
Neil Roberts 2009-10-07 11:31:44 +01:00
parent a4ff4d37a4
commit 13ac1fe75b

View File

@ -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 != NULL, NULL);
g_return_val_if_fail (id_pool->array != 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 " g_warning ("The required ID of %u does not refer to an existing actor; "
"usually implies that the pick() of an actor is not " "this usually implies that the pick() of an actor is not "
"correctly implemented or that there is an error in the " "correctly implemented or that there is an error in the "
"glReadPixels() implementation of the GL driver.", id); "glReadPixels() implementation of the GL driver.", id);
return NULL; return NULL;
} }
array = (void*) id_pool->array->data;
return array[id]; return array[id];
} }