[gtk+/a11y] GailImageCell: Deal with absence of pixbufs



commit 7ee7c1eb5f220fa562400c13f888ba45144529d4
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Jun 21 18:52:24 2011 -0400

    GailImageCell: Deal with absence of pixbufs
    
    ...and when there are pixbufs, don't leak them.

 gtk/a11y/gailimagecell.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gtk/a11y/gailimagecell.c b/gtk/a11y/gailimagecell.c
index 078b4b7..b35b37e 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);
+    }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]