From ba69862a44d602b5321d689f20dd612919604e5b Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sun, 25 Jan 2015 16:13:04 +0100 Subject: [PATCH] Bug 742159 - Empty gradient in loaded tool preset gimp_tool_preset_deserialize_property(): initialize all object properties (brush, pattern, gradient, ...) of the preset's GimpToolOptions with non-NULL values from the user context, so loading a broken preset never results in NULL objects being used. --- app/core/gimptoolpreset.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/core/gimptoolpreset.c b/app/core/gimptoolpreset.c index ece584efd9..b4c6003c65 100644 --- a/app/core/gimptoolpreset.c +++ b/app/core/gimptoolpreset.c @@ -374,6 +374,20 @@ gimp_tool_preset_deserialize_property (GimpConfig *config, "gimp", tool_preset->gimp, NULL); + /* Initialize all GimpContext object properties that can be + * used by presets with some non-NULL object, so loading a + * broken preset won't leave us with NULL objects that have + * bad effects. See bug #742159. + */ + gimp_context_copy_properties (gimp_get_user_context (tool_preset->gimp), + GIMP_CONTEXT (options), + GIMP_CONTEXT_BRUSH_MASK | + GIMP_CONTEXT_DYNAMICS_MASK | + GIMP_CONTEXT_PATTERN_MASK | + GIMP_CONTEXT_GRADIENT_MASK | + GIMP_CONTEXT_PALETTE_MASK | + GIMP_CONTEXT_FONT_MASK); + if (! GIMP_CONFIG_GET_INTERFACE (options)->deserialize (GIMP_CONFIG (options), scanner, 1, NULL))