After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 324667 - gdk_pixbuf_loader_write doesn't signal until 1k is written.
gdk_pixbuf_loader_write doesn't signal until 1k is written.
Status: RESOLVED NOTABUG
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other All
: Normal minor
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-12-21 02:34 UTC by Jason LeBrun
Modified: 2010-07-10 04:04 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12



Description Jason LeBrun 2005-12-21 02:34:20 UTC
Please describe the problem:
When using the gdk_pixbuf_loader widget, I noticed that certain images are not
loaded. I've found that it seems to occur when the image size is less than 1k. 

Steps to reproduce:
//Run this this with filename_of_small_image pointing to a file
//with a jpg under 1024k

GdkPixbufLoader *loader;
GdkPixbuf* pixbuf;
char* data;
int len=0;
FILE* icon_file=fopen(filename_of_small_image,"r");
while(!feof(icon_file)) data[len++]=fgetc(icon_file);


loader=gdk_pixbuf_loader_new();
gdk_pixbuf_loader_write(loader,data,len,&err);
//No area_prepared or area_updated signals get emitted. 
pixbuf=gdk_pixbuf_loader_get_pixbuf(loader);
//pixbuf will be null.


Actual results:
See comments.

Expected results:
I expect some signals to be emitted, and pixbuf to be non-null.

Does this happen every time?
Yes, whenever the file is under 1024  bytes.

Other information:
Workaround: pad the image with trailing 0's pushing it up to 1024 bytes in size.
Comment 1 Matthias Clasen 2005-12-21 04:28:06 UTC
What gtk version ? 

I believe this has been fixed in one of the last versions
Comment 2 Matthias Clasen 2005-12-21 06:48:37 UTC
I was thinking of bug 318589
Comment 3 Matthias Clasen 2005-12-21 16:33:55 UTC
Oh, I see now what is wrong. You need to call gdk_pixbuf_loader_close() when
you have fed all data to it, then it will work.
Comment 4 Jason LeBrun 2005-12-21 17:23:29 UTC
Ok, that fixed it. It's a slightly "non-traditional" way of using a close function, which is why I didn't do it that way. Moving things around fixes the code.

Are there any caveats with this, with threads, for example? Couldn't the pixbuf be destroyed between the call to _write and _get_pixbuf?
Comment 5 Jason LeBrun 2005-12-21 17:26:02 UTC
Sorry, I meant between _close and _get_pixbuf.