a11y: don't return random numbers

Return 0 for the image size if we don't have a pixbuf to measure.
This commit is contained in:
Matthias Clasen 2011-08-29 10:50:01 -04:00
parent 006d46362c
commit 1090eba9a8
2 changed files with 6 additions and 0 deletions

View File

@ -129,6 +129,9 @@ gtk_image_cell_accessible_get_image_size (AtkImage *image,
GtkCellRenderer *cell_renderer;
GdkPixbuf *pixbuf = NULL;
*width = 0;
*height = 0;
cell_renderer = GTK_RENDERER_CELL_ACCESSIBLE (cell)->renderer;
g_object_get (GTK_CELL_RENDERER_PIXBUF (cell_renderer),
"pixbuf", &pixbuf,

View File

@ -7316,6 +7316,9 @@ gtk_icon_view_item_accessible_get_image_size (AtkImage *image,
if (atk_state_set_contains_state (item->state_set, ATK_STATE_DEFUNCT))
return;
*width = 0;
*height = 0;
if (get_pixbuf_box (GTK_ICON_VIEW (item->widget), item->item, &box))
{
*width = box.width;