[gthumb/gthumb-2-14] Make sure to unref the original pixbuf



commit fbc2237a14cc13fe4ad68fbbb9b56aa37c60d1eb
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Nov 3 21:30:30 2011 +0100

    Make sure to unref the original pixbuf
    
    pixbuf can point to the colorized pixbuf, added another variable
    than always points to the original pixbuf.  Initialize file and
    thumbnail to NULL.

 gthumb/gth-cell-renderer-thumbnail.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gthumb/gth-cell-renderer-thumbnail.c b/gthumb/gth-cell-renderer-thumbnail.c
index 891ba50..a6deb5d 100644
--- a/gthumb/gth-cell-renderer-thumbnail.c
+++ b/gthumb/gth-cell-renderer-thumbnail.c
@@ -245,6 +245,7 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer      *cell,
 	GdkRectangle              image_rect;
 	cairo_t                  *cr;
 	GdkPixbuf                *pixbuf;
+	GdkPixbuf                *original_pixbuf;
 	int                       xpad;
 	int                       ypad;
 	GdkPixbuf                *colorized = NULL;
@@ -273,7 +274,7 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer      *cell,
 
 	cr = gdk_cairo_create (window);
 
-	pixbuf = self->priv->thumbnail;
+	pixbuf = original_pixbuf = self->priv->thumbnail;
 	if (pixbuf == NULL)
 		return;
 
@@ -411,7 +412,7 @@ gth_cell_renderer_thumbnail_render (GtkCellRenderer      *cell,
 	cairo_fill (cr);
 
 	_g_object_unref (colorized);
-	g_object_unref (pixbuf);
+	g_object_unref (original_pixbuf);
 	cairo_destroy (cr);
 }
 
@@ -494,6 +495,8 @@ gth_cell_renderer_thumbnail_init (GthCellRendererThumbnail *self)
 	self->priv = g_new0 (GthCellRendererThumbnailPrivate, 1);
 	self->priv->size = DEFAULT_THUMBNAIL_SIZE;
 	self->priv->checked = TRUE;
+	self->priv->file = NULL;
+	self->priv->thumbnail = NULL;
 }
 
 



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