babl: re-creation of palette conversions must always set data.
authorJehan <jehan@girinstud.io>
Wed, 3 Mar 2021 10:03:38 +0000 (11:03 +0100)
committerØyvind "pippin" Kolås <pippin@gimp.org>
Sat, 15 May 2021 20:57:03 +0000 (20:57 +0000)
commit69e6b09067f2bbca7ac0dfda0131042d7d1f448c
treefcf529219d200701e5e0ebc5a62f8134e6b96a3f
parent4c7c2b75e56626a1270cd96f8951f0163ceb5451
babl: re-creation of palette conversions must always set data.

If we allow conversions to be recreated for palettes, it will create a
new identical conversion with collision number incremented in the name
and no user data. Yet the user data is extremely important for palette
conversions, because it contains the palette itself which is required by
the palette conversion functions. Hence we end up crashing.

Moreover, although I think that right now, only palette conversions use
the data field, it might be used for other type of data in the future.
In any case, we should always save this data along as it has been stored
there for a reason.

Finally in babl-palette code, make sure the user data is added to the
models before creating the formats and conversions as we also ended up
in crash-happy code when we didn't.

See: https://gitlab.gnome.org/GNOME/gimp/-/issues/6501
babl/babl-fish-path.c
babl/babl-palette.c