From 7f44184f610ddf69a567295dc72db2e1312d51f7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 21 Jun 2011 18:52:24 -0400 Subject: [PATCH] GailImageCell: Deal with absence of pixbufs ...and when there are pixbufs, don't leak them. --- gtk/a11y/gailimagecell.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gtk/a11y/gailimagecell.c b/gtk/a11y/gailimagecell.c index 078b4b7cac..b35b37eba9 100644 --- a/gtk/a11y/gailimagecell.c +++ b/gtk/a11y/gailimagecell.c @@ -160,11 +160,16 @@ gail_image_cell_get_image_size (AtkImage *image, { GailImageCell *cell = GAIL_IMAGE_CELL (image); GtkCellRenderer *cell_renderer; - GdkPixbuf *pixbuf; + GdkPixbuf *pixbuf = NULL; cell_renderer = GAIL_RENDERER_CELL (cell)->renderer; g_object_get (GTK_CELL_RENDERER_PIXBUF (cell_renderer), "pixbuf", &pixbuf, NULL); - *width = gdk_pixbuf_get_width (pixbuf); - *height = gdk_pixbuf_get_height (pixbuf); + if (pixbuf) + { + *width = gdk_pixbuf_get_width (pixbuf); + *height = gdk_pixbuf_get_height (pixbuf); + + g_object_unref (pixbuf); + } }