Skip to content
Commit 4c7c2b75 authored by Jehan's avatar Jehan Committed by Øyvind "pippin" Kolås
Browse files

babl: do not append space to the format name when explicitly set.

When a format is named explicitly by the caller, we should just keep the
same name, not tweak it. Generating a name is only valid when no
explicit name is given. Moreover this is the behavior as described in
the docs of babl_format_new():

> If no name is provided a (long) descriptive name is used.

(which usually implies that with a name provided, this one will be used
instead of a generated name)

This is especially important for palette formats for which name is
mostly not descriptive anyway (either caller-set or generated by babl
with incremental number) and this fixes a bug when calling
babl_new_palette_with_space() with the same name and space would fail to
find the already created formats (yet would find the models and return
NULL for both formats) because it would search without the space
description appended. Yet the docs of babl_new_palette*() clearly says
as well:

> If you pass in the same name the previous formats will be provided
> again.

Moreover we actually already tweak a bit the palette format name by
appending the space pointer. No need to tweak it twice appending the
same information (space) in a different way.

See also: https://gitlab.gnome.org/GNOME/gimp/-/issues/6501
parent 0a87f731
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment