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 536403 - Python plugin remembers layer selections that are no longer valid
Python plugin remembers layer selections that are no longer valid
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Gimp-Python
2.4.x
Other All
: Normal normal
: 2.4
Assigned To: Manish Singh
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2008-06-03 11:09 UTC by Artis Rozentāls
Modified: 2008-10-30 20:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adds some checks to not create python objects from invalid ids (3.12 KB, patch)
2008-06-15 15:26 UTC, Lars-Peter Clausen
committed Details | Review

Description Artis Rozentāls 2008-06-03 11:09:41 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):
  • File "/usr/lib/gimp/2.0/python/gimpfu.py", line 767 in _run
    res = _interact(proc_name, params[1:])
  • File "/usr/lib/gimp/2.0/python/gimpfu.py", line 688 in _interact
    wid = _edit_mapping[pf_type](def_val)
  • File "/usr/lib/gimp/2.0/python/gimpui.py", line 141 in __init__
    self.set_active_layer(default)
TypeError: GimpLayerComboBox.set_active_layer() argument 1 must be gimp.Layer, not gimp.Channel



Expected results:
Script to default to the layer specified in PF_LAYER.

Does this happen every time?
Yes.

Other information:
Comment 1 Lars-Peter Clausen 2008-06-15 15:26:22 UTC
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.
Comment 2 Sven Neumann 2008-07-02 07:10:53 UTC
Very nice. Please commit to both branches (gimp-2-4 and trunk). Or let us know if we should commit this for you.
Comment 3 Lars-Peter Clausen 2008-07-03 11:45:40 UTC
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.