mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
libgimp: Fix critical for int SpinScale API
The GimpProcedureDialog API allows int and double SpinScales. However, it calls gimp_prop_widget_set_factor () which requires doubles. A conditional check for a double property was added to this call. A check was also added to ensure int properties have a factor of 1.0.
This commit is contained in:
parent
f785f18892
commit
7c72202416
1 changed files with 6 additions and 4 deletions
|
@ -1072,6 +1072,7 @@ gimp_procedure_dialog_get_int_radio (GimpProcedureDialog *dialog,
|
|||
* #GimpSpinScale for. It must be a property of the
|
||||
* #GimpProcedure @dialog has been created for.
|
||||
* @factor: a display factor for the range shown by the widget.
|
||||
* It must be set to 1.0 for integer properties.
|
||||
*
|
||||
* Creates a new #GimpSpinScale for @property which must necessarily be
|
||||
* an integer or double property.
|
||||
|
@ -1112,8 +1113,9 @@ gimp_procedure_dialog_get_spin_scale (GimpProcedureDialog *dialog,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (G_PARAM_SPEC_TYPE (pspec) == G_TYPE_PARAM_INT ||
|
||||
G_PARAM_SPEC_TYPE (pspec) == G_TYPE_PARAM_DOUBLE, NULL);
|
||||
g_return_val_if_fail (G_PARAM_SPEC_TYPE (pspec) == G_TYPE_PARAM_DOUBLE ||
|
||||
(G_PARAM_SPEC_TYPE (pspec) == G_TYPE_PARAM_INT &&
|
||||
factor == 1.0), NULL);
|
||||
|
||||
/* First check if it already exists. */
|
||||
widget = g_hash_table_lookup (dialog->priv->widgets, property);
|
||||
|
@ -1139,6 +1141,7 @@ gimp_procedure_dialog_get_spin_scale (GimpProcedureDialog *dialog,
|
|||
|
||||
widget = gimp_prop_spin_scale_new (G_OBJECT (dialog->priv->config),
|
||||
property, step, page, digits);
|
||||
if (G_PARAM_SPEC_TYPE (pspec) == G_TYPE_PARAM_DOUBLE)
|
||||
gimp_prop_widget_set_factor (widget, factor, step, page, digits);
|
||||
|
||||
gimp_procedure_dialog_check_mnemonic (dialog, widget, property, NULL);
|
||||
|
@ -1858,7 +1861,6 @@ gimp_procedure_dialog_fill_expander (GimpProcedureDialog *dialog,
|
|||
return expander;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_procedure_dialog_fill_scrolled_window:
|
||||
* @dialog: the #GimpProcedureDialog.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue