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 347593 - next/prev color in palette crashes for 0-sized palettes.
next/prev color in palette crashes for 0-sized palettes.
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
git master
Other All
: Normal normal
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2006-07-15 11:12 UTC by david gowers
Modified: 2006-07-18 07:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
fix (1021 bytes, patch)
2006-07-15 11:15 UTC, david gowers
committed Details | Review

Description david gowers 2006-07-15 11:12:56 UTC
.. by which I mean, when a palette editor is open and it is editing an empty palette (ie with 0 colors in it), using any of the 
`context-(palette|swatch)-*-*`
actions causes a crash.
the attached trivial patch fixes this.
Comment 1 david gowers 2006-07-15 11:15:33 UTC
Created attachment 68962 [details] [review]
fix

(checks for palette->n_colors == 0 as an additional 'failure' condition for the relevant functions.)
Comment 2 Michael Natterer 2006-07-15 14:06:19 UTC
Thanks, will apply that as soon as there is a writable gimp repository
again ;)
Comment 3 Michael Natterer 2006-07-16 10:55:39 UTC
For completeness, shouldn't the patch also check the (pathological and
probably impossible) case of indexed images with a zero-length colormap?
Comment 4 david gowers 2006-07-17 04:00:44 UTC
If you try that, as follows:
  # (load an image in)
  # (open the python console)
  i = gimp.image_list()[0]
  i.colormap=''
  # (use one of the colormap/swatch actions)

You will see that in that case, the swatch-* actions default to using the palette editor instead, and the colormap-* actions do nothing.

So, already accounted for (unless you can engineer a situation where image colormap is non-NULL when zero-sized -- which would have to involve messing around with image->cmap directly.)

Comment 5 Sven Neumann 2006-07-18 07:45:23 UTC
2006-07-18  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimppaletteeditor.c (gimp_palette_editor_get_index,
	 gimp_palette_editor_set_index, gimp_palette_editor_max_index):
	fixed potential crash based on a patch from David Gowers (bug #347593).