GNOME Bugzilla – Bug 536403
Python plugin remembers layer selections that are no longer valid
Last modified: 2008-10-30 20:13:38 UTC
Please describe the problem: Deleting a previviously selected layer in a script interface renders the script inoperable until GIMP is restarted. Steps to reproduce: 1. Use a python script that takes advantage of PF_LAYER. 2. Delete the layer that was selected in the interface. 3. Run script again. Actual results: Script fails with: Traceback (most recent call last):
+ Trace 199473
res = _interact(proc_name, params[1:])
wid = _edit_mapping[pf_type](def_val)
self.set_active_layer(default)
Expected results: Script to default to the layer specified in PF_LAYER. Does this happen every time? Yes. Other information:
Created attachment 112780 [details] [review] Adds some checks to not create python objects from invalid ids Added checks to (pygimp_{image,drawable,layer,channel,vectores,display}_new) to ensure that a python object only gets created when the object id is valid, otherwise the function returns Py_None. Also fixes crashes in lay_repr and chn_repr when the ID is invalid and no name returned.
Very nice. Please commit to both branches (gimp-2-4 and trunk). Or let us know if we should commit this for you.
Fixed in SVN 2008-07-03 Lars-Peter Clausen <lars@metafoo.de> * plug-ins/pygimp/pygimp-drawable.c * plug-ins/pygimp/pygimp-vectors.c * plug-ins/pygimp/pygimp-display.c * plug-ins/pygimp/pygimp-image.c: Added checks to ensure that a python object only is created if its id is valid. Fixes bug #536403. * plug-ins/pygimp/pygimp-pdb.c * plug-ins/pygimp/pygimp-tile.c * plug-ins/pygimp/pygimp-colors.c * plug-ins/pygimp/pygimp.h: Fix crashing when pygimp is used with python-2.5 on 64 bit systems. Fixes bug #540629.