On Fri, Jan 20, 2006 at 11:36:38AM +0100, László Monda wrote:
> Hi List,
> 
> I've just written a simple GDK application that basically converts an
> input JPEG image to a BMP using a Pixbuf.
> 
> Unfortunately it segfaults.
> 
> ----8<----
> 
> #include <gtk/gtk.h>
> 
> int main(int argc, char *argv[])
> {
>     gdk_init(&argc, &argv);
> 
>     GError **error = NULL;
>     GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file("input.jpg", error);
>     gdk_pixbuf_save(pixbuf, "output.bmp", "bmp", error);
> 
>     return 0;
> }
> 
> ----8<----
> 
> Could someone here explain why does it segfault?

The list of gdk_pixbuf_save() options must be
NULL-terminated, that means if you don't pass any options
you still have to pass the terminating NULL.  The use of
GError is errorneous too, but since you effectively pass
NULL (and thus ignore errors), it does not cause the crash.

Yeti


--
That's enough.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to