[gimp] Bug 749341 - Gradient Editor corrupts gradient
- From: Thomas Manni <tmanni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 749341 - Gradient Editor corrupts gradient
- Date: Thu, 14 May 2015 00:09:24 +0000 (UTC)
commit 912289dbddf483da75471c9e211321a7d6f83db1
Author: Thomas Manni <thomas manni free fr>
Date: Thu May 14 01:50:44 2015 +0200
Bug 749341 - Gradient Editor corrupts gradient
Check for valid GimpGradientSegmentType and GimpGradientSegmentColor
enum values before updating gradient segment.
app/actions/gradient-editor-commands.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/app/actions/gradient-editor-commands.c b/app/actions/gradient-editor-commands.c
index daa0a5f..fdfd680 100644
--- a/app/actions/gradient-editor-commands.c
+++ b/app/actions/gradient-editor-commands.c
@@ -382,19 +382,24 @@ gradient_editor_blending_func_cmd_callback (GtkAction *action,
{
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpGradient *gradient;
+ GEnumClass *enum_class = NULL;
GimpGradientSegmentType type;
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
type = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
- if (gradient && type >= 0)
+ enum_class = g_type_class_ref (GIMP_TYPE_GRADIENT_SEGMENT_TYPE);
+
+ if (gradient && g_enum_get_value (enum_class, type))
{
gimp_gradient_segment_range_set_blending_function (gradient,
editor->control_sel_l,
editor->control_sel_r,
type);
}
+
+ g_type_class_unref (enum_class);
}
void
@@ -404,19 +409,24 @@ gradient_editor_coloring_type_cmd_callback (GtkAction *action,
{
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (data);
GimpGradient *gradient;
+ GEnumClass *enum_class = NULL;
GimpGradientSegmentColor color;
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
color = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
- if (gradient && color >= 0)
+ enum_class = g_type_class_ref (GIMP_TYPE_GRADIENT_SEGMENT_COLOR);
+
+ if (gradient && g_enum_get_value (enum_class, color))
{
gimp_gradient_segment_range_set_coloring_type (gradient,
editor->control_sel_l,
editor->control_sel_r,
color);
}
+
+ g_type_class_unref (enum_class);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]