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 674691 - gdk_pixbuf_new_from_data() is not introspectable due to PixbufDestroyNotify argument
gdk_pixbuf_new_from_data() is not introspectable due to PixbufDestroyNotify a...
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
Depends on:
Reported: 2012-04-24 05:10 UTC by Jay Rambhia
Modified: 2014-07-19 03:14 UTC
See Also:
GNOME target: ---
GNOME version: ---

PixbufDestroyNotify (1.88 KB, text/plain)
2012-04-24 05:10 UTC, Jay Rambhia

Description Jay Rambhia 2012-04-24 05:10:33 UTC
Created attachment 212661 [details]

I am unable to access GdkPixbuf.PixbufDestroyNotfiy. I am getting an error.
Error: NotImplementedError.
I am getting the same error even when try
>>> help(GdkPixbuf.PixbufDestroyNotify)
in ipython.
I have described the error that I encountered and attached it in the file..
I think the bindings are incomplete. Please look into it.
Comment 1 Martin Pitt 2012-04-24 06:04:37 UTC
You are not supposed to provide destroy notify methods when using GI bindings, these need to be provided by pygobject/gjs/etc. themselves. pygobject automatically provides GDestroyNotify arguments, but as PixbufDestroyNotify is a custom thing from gdk-pixbuf, this cannot be handled.

One possible way to make this introspectable would be for gdk-pixbuf to make PixbufDestroyNotify an alias for GDestroyNotify (to maintain API compatibility), and actually use GDestroyNotify. This would be an ABI break, though.

So right now I'm afraid that new_from_data() is not introspectable due to this. Fortunately it is the only method that needs a PixbufDestroyNotify, so you can still use new_from_file(), or just new() and set the data later.
Comment 2 John Stowers 2012-07-10 20:26:35 UTC
I have been looking into how to make GdkPixbuf play nicely with numpy again (as pygtk used to).

I am going to be at GUADEC to discuss this (and other perspectives on using PyGObject+Gtk in a scientific context)

Any ideas for how to proceed with this?
Comment 3 J90314 2012-09-08 08:40:31 UTC
> or just new() and set the data later

This probably isn't the best place to ask, but how would you do this?  The only thing I can see is Pixbuf.get_pixels(), which gives me an immutable bytes object.
Comment 4 Matthias Clasen 2014-07-19 03:14:45 UTC
This has recently been improved by introducing ways to create pixbufs from GBytes and extract the data in that form, so at least the memory management problem of destroy notifies should be lessened.