GNOME Bugzilla – Bug 378334
Plugins with image drop-list crash when image is closed
Last modified: 2012-10-08 20:08:24 UTC
Please describe the problem: Plugins that are parameterized by another images have a drop-list that gets populated with all open images/layers. If, after you open the plugin, you close one of these images, then the plugin becomes unstable. If you select the now-closed image in the plugin's drop-list, the plugin will crash. Steps to reproduce: 1. File->New to create a new image. 2. File->New to create another image. 3. On "Untitled-1" choose Filter->Map->BumpMap... 4. Close the "Untitled-2" image. 5. In the "Bump Map" plugin UI, select "Untitled-2" in the "Bump map:" list. Actual results: On Fedora Core 6, the "Bump Map" dialog prompty disappears with no explaination, which is strange. On Windows Vista, Dr. Watson informs you that bumpmap.exe has stopped working and checks for solutions. Then GIMP displays a dialog box that says a plugin has crashed and may have messed with Gimp's internal state. Even if there is no data loss, this is alarming. Expected results: I'd expect for Untitled-2 to not be present in the drop-list once it is closed. If this is not possible, then I'd expect a dialog box to indicate that selecting Untitled-2 is not possible, since the image has already been closed. Does this happen every time? Yes Other information: This problem is not specific to bumpmap.exe. I have reproduced it on the "Displace" filter, too. I suspect it's a problem with all plugins that operate on images. I have given this a severity of "Normal", instead of "Critical" because GIMP, itself, does not crash.
Very difficult to fix. The plug-in has no way to get notified when an image closes. It could try to check the image-ID whenever it uses it, but that's also not feasible.
Well, we can at least try to give a more useful error message in GIMP 2.3: 2006-11-23 Sven Neumann <sven@gimp.org> * app/pdb/gimpprocedure.c (gimp_procedure_validate_args): special case invalid drawable and image IDs and try to give a somewhat more helpful error message (addresses bug #378334).
If we had an easy way to check the validity of image and drawable IDs in libgimp, then we could probably fix this by adding those checks to the plug-ins that need it. I suggest that we add such functions to libgimp for GIMP 2.4.
2007-01-12 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/vectors.pdb: added PDB functions to validate display, drawable, image and vectors IDs.
Lowering priority as we now have the necessary API in libgimp. We can now easily fix such problems when they turn up, even after the 2.4.0 release.
Fixed in master and gimp-2-8: commit 3b55877acad413e0b5893fb2dfcaea8bc55b6ed9 Author: Michael Natterer <mitch@gimp.org> Date: Mon Oct 8 22:01:30 2012 +0200 Bug 378334 - Plugins with image drop-list crash when image is closed Let image and item combo boxes connect to their own "changed" signal first, and if the chosen image/item doesn't exist any longer, reinitialize the combo box and select the first item instead. Also fixes the type macros in gimpitemcombobox.h which were lacking a ')' and introduces an internal GimpItemComboBox class to hold the common functionality. (cherry picked from commit 4aaaa1a7fa9d5f80121f07a01adb79d41ab77684) libgimp/gimpimagecombobox.c | 62 ++++++++++++--- libgimp/gimpitemcombobox.c | 227 +++++++++++++++++++++++++++++++------------------------ libgimp/gimpitemcombobox.h | 8 +- 3 files changed, 187 insertions(+), 110 deletions(-)