app: fix a crash in GIMP when calling gimp:curves with GIMP_HISTOGRAM_LUMINANCE…
… from a plug-in. The value is accepted by the current specification of "channel" but it is actually not supported and would end up crashing the core process. The real fix which should happen would be to make GimpParamSpecEnum usable in libgimp, and be able to pass its spec through the PDB. Then we could use this param spec instead of GParamSpecEnum for such property not supporting all values in an enum. Note that with the current fix, the "gimp:curves" filter will silently refuse the Luminance channel when passed as "channel". It is not ideal. But it's better than crashing the whole of GIMP!
This commit is contained in:
parent
696b756f7d
commit
7b3052dcdd
1 changed files with 15 additions and 2 deletions
|
|
@ -119,6 +119,15 @@ gimp_curves_config_class_init (GimpCurvesConfigClass *klass)
|
|||
_("Work on linear RGB (this property is ignored; use \"trc\" instead)"),
|
||||
TRUE, 0);
|
||||
|
||||
/* Only channels GIMP_HISTOGRAM_VALUE to GIMP_HISTOGRAM_ALPHA are
|
||||
* supported right now in this op. Unfortunately this is not visible
|
||||
* through the param specification. The GimpParamSpecEnum would allow
|
||||
* to make it visible, but it does not exist on libgimp side right
|
||||
* now, so plug-in writers would see it listed as allowed.
|
||||
*
|
||||
* TODO: GimpParamSpecEnum should be moved to libgimpbase
|
||||
* (libgimpbase/gimpparamspecs.h) and passed through PDB.
|
||||
*/
|
||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_CHANNEL,
|
||||
"channel",
|
||||
_("Channel"),
|
||||
|
|
@ -231,8 +240,12 @@ gimp_curves_config_set_property (GObject *object,
|
|||
break;
|
||||
|
||||
case PROP_CHANNEL:
|
||||
self->channel = g_value_get_enum (value);
|
||||
g_object_notify (object, "curve");
|
||||
if (g_value_get_enum (value) >= GIMP_HISTOGRAM_VALUE &&
|
||||
g_value_get_enum (value) <= GIMP_HISTOGRAM_ALPHA)
|
||||
{
|
||||
self->channel = g_value_get_enum (value);
|
||||
g_object_notify (object, "curve");
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_CURVE:
|
||||
|
|
|
|||
Loading…
Reference in a new issue