plug-ins: Fix #15818 gfig crash and critical when opening saved gfig

When opening a saved gfig file that came with GIMP, I noticed
several criticals:
GEGL-CRITICAL **: 09:16:16.320: gegl_color_get_format: assertion
 'GEGL_IS_COLOR (color)' failed
After that the gfig plug-in crashed.

After examination I noticed that the initial style gets copied. In
the case of the default style this means the source and destination
are the same.
When duplicating our code first removed the GEGL color objects from
the destination style before assigning from the source. But because
they are the same, this leads to invalid colors. Before the change
to GEGL colors they were simple values where reassigning didn't matter,
but here it does.
Since the same function does other assignments with resources that
may cause later issues, let's just return right away if the source
and destination style are the same.
This commit is contained in:
Jacob Boerema 2026-02-06 13:34:01 -05:00
parent 7ac037e346
commit 84fb1b3ce5

View file

@ -573,6 +573,10 @@ gfig_style_copy (Style *style1,
Style *style0,
const gchar *name)
{
if (style1 == style0)
/* Initializing the default style: return without copying */
return;
if (name)
style1->name = g_strdup (name);
else