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.
This commit is contained in:
Michael Natterer 2015-01-25 16:13:04 +01:00
parent 4ace9e526e
commit ba69862a44
1 changed files with 14 additions and 0 deletions

View File

@ -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))