Declaration [src]

purple_gdk_pixbuf_new_from_file (
  const char* filename

Description [src]

Helper function that calls gdk_pixbuf_new_from_file() and checks both the return code and the GError and returns NULL if either one failed.

The gdk-pixbuf documentation implies that it is sufficient to check the return value of gdk_pixbuf_new_from_file() to determine whether the image was able to be loaded. However, this is not the case with gdk-pixbuf 2.23.3 and probably many earlier versions. In some cases a GdkPixbuf object is returned that will cause some operations (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an infinite loop.

This function shouldn’t be necessary once Pidgin requires a version of gdk-pixbuf where the aforementioned bug is fixed. However, it might be nice to keep this function around for the debug message that it logs.


filename const char*

Name of file to load, in the GLib file name encoding.

 The data is owned by the caller of the function.
 The value is a NUL terminated UTF-8 string.

Return value

Returns: GdkPixbuf

The GdkPixbuf if successful. Otherwise NULL is returned and a warning is logged.

 The caller of the function takes ownership of the data, and is responsible for freeing it.