[gaim-migrate @ 14935]

Wed, 21 Dec 2005 18:43:39 +0000

author
Richard Laager <rlaager@pidgin.im>
date
Wed, 21 Dec 2005 18:43:39 +0000
changeset 12601
be19ef28e2ce
parent 12600
7ecd4441fdc7
child 12602
29341621145b

[gaim-migrate @ 14935]
Jason LeBrun wrote to gaim-devel:

"I have found a small quirk in the way gdk_pixbuf_loader works. When you
are using it without signalling, the proper way to use it is to call
gdk_pixbuf_loader_close *before* calling gdk_pixbuf_loader_get_animation
or gdk_pixbuf_loader_get_pixbuf. The call to gdk_pixbuf_loader_close
signals that no more writes will be occuring.

In particular, this affects images that are less than 1k in size. If
gdk_pixbuf_loader_close is not called before _get_animation, the loader
will not return anything unless it has received more than 1k of data
(the file type sniffing buffer size) or it has been closed.

So, the proper order of calls for loaders in the gtk*.c code is:

gdk_pixbuf_loader_new();
gdk_pixbuf_loader_write();
gdk_pixbuf_loader_close();
gdk_pixbuf_loader_get_animation();"

I know we fixed a bug by changing this in one place. I've gone through and updated the rest.

src/gtkaccount.c file | annotate | diff | comparison | revisions
src/gtkblist.c file | annotate | diff | comparison | revisions
src/gtkconv.c file | annotate | diff | comparison | revisions
--- a/src/gtkaccount.c	Wed Dec 21 18:36:19 2005 +0000
+++ b/src/gtkaccount.c	Wed Dec 21 18:43:39 2005 +0000
@@ -573,11 +573,11 @@
 		gdk_pixbuf_loader_write(loader, data, st.st_size, NULL);
 		g_free(data);
 	}
+	gdk_pixbuf_loader_close(loader, NULL);
 	pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
 	width = gdk_pixbuf_get_width(pixbuf);
 	height = gdk_pixbuf_get_height(pixbuf);
 	format = gdk_pixbuf_loader_get_format(loader);
-	gdk_pixbuf_loader_close(loader, NULL);
 	g_object_unref(G_OBJECT(loader));
 #endif
 	pixbuf_formats =  gdk_pixbuf_format_get_extensions(format);
--- a/src/gtkblist.c	Wed Dec 21 18:36:19 2005 +0000
+++ b/src/gtkblist.c	Wed Dec 21 18:43:39 2005 +0000
@@ -2061,10 +2061,10 @@
 	loader = gdk_pixbuf_loader_new();
 	data = gaim_buddy_icon_get_data(icon, &len);
 	gdk_pixbuf_loader_write(loader, data, len, NULL);
+	gdk_pixbuf_loader_close(loader, NULL);
 	buf = gdk_pixbuf_loader_get_pixbuf(loader);
 	if (buf)
 		g_object_ref(G_OBJECT(buf));
-	gdk_pixbuf_loader_close(loader, NULL);
 	g_object_unref(G_OBJECT(loader));
 
 	if (buf) {
--- a/src/gtkconv.c	Wed Dec 21 18:36:19 2005 +0000
+++ b/src/gtkconv.c	Wed Dec 21 18:43:39 2005 +0000
@@ -5506,10 +5506,10 @@
 
 	loader = gdk_pixbuf_loader_new();
 	gdk_pixbuf_loader_write(loader, data, len, NULL);
+	gdk_pixbuf_loader_close(loader, &err);
 	anim = gdk_pixbuf_loader_get_animation(loader);
 	if (anim)
 		g_object_ref(G_OBJECT(anim));
-	gdk_pixbuf_loader_close(loader, &err);
 	g_object_unref(loader);
 
 	if (!anim)

mercurial