Actually free the temporary pixbuf data.

This commit is contained in:
Matthias Clasen
2004-08-24 14:44:43 +00:00
parent b97018ad7f
commit fabf8664f8

View File

@ -290,6 +290,13 @@ rl_encode_rgbx (guint8 *bp, /* dest buffer */
return bp; return bp;
} }
/* Used as the destroy notification function for gdk_pixbuf_new() */
static void
free_buffer (guchar *pixels, gpointer data)
{
g_free (pixels);
}
/** /**
* gdk_pixdata_from_pixbuf: * gdk_pixdata_from_pixbuf:
* @pixdata: a #GdkPixdata to fill. * @pixdata: a #GdkPixdata to fill.
@ -341,12 +348,12 @@ gdk_pixdata_from_pixbuf (GdkPixdata *pixdata,
pixbuf->width, pixbuf->width,
pixbuf->height, pixbuf->height,
rowstride, rowstride,
NULL, NULL); free_buffer, NULL);
gdk_pixbuf_copy_area (pixbuf, 0, 0, pixbuf->width, pixbuf->height, gdk_pixbuf_copy_area (pixbuf, 0, 0, pixbuf->width, pixbuf->height,
buf, 0, 0); buf, 0, 0);
} }
else else
buf = pixbuf; buf = (GdkPixbuf *)pixbuf;
pad = rowstride; pad = rowstride;
pad = MAX (pad, 130 + n_bytes / 127); pad = MAX (pad, 130 + n_bytes / 127);
data = g_new (guint8, pad + n_bytes); data = g_new (guint8, pad + n_bytes);