GNOME Bugzilla – Bug 159051
Make gimp_displays_reconnect() take over the new image's initial refcount
Last modified: 2004-12-22 21:47:04 UTC
As discussed on gimp-developer, there is a problem with gimp_displays_reconnect() which causes the new image to be leaked. To properly fix this, IMHO the following changes need to be done: (1) work as documented (fail if the new image already has a display). (2) also fail if the old image has no display. (3) make it take over the reference count on success.
Uh? I think the conclusion on the list was that the script was broken and the GIMP behaviour entirely correct. At least that's what my experiments with the Script-Fu console showed.
The current implementation makes it impossible to get rid of the new image, because gimp_image_delete() does not work on images which have a display. The PDB API should not have to bother with reference counts and the general rule is that once there is s display for an image, there is no way of deleting it via the PDB.
Well, it needs to be fixed then.
Fixed in CVS: 2004-11-29 Michael Natterer <mitch@gimp.org> * tools/pdbgen/pdb/display.pdb: make it work as documented (fail if the new_image already has a display). Also fail if the old_image doesn't have any display (changed docs accordingly). On success, take over the initial reference count of the new image, just as the gimp_display_new() PDB wrapper does. Fixes bug #159051. * app/pdb/display_cmds.c * libgimp/gimpdisplay_pdb.c: regenerated.