libgimpconfig: allow gimp_config_type_register() with 0 pspecs.

There is at least one valid case of a config type registration with no
parameters: when registering the gegl:nop operation. This is the default
case when running the GEGL operation tool. See implementation of
gimp_filter_tool_get_operation().
Therefore we ended up crashing GIMP just by calling this tool.
This commit is contained in:
Jehan 2019-09-17 12:55:04 +02:00
parent 642e47efaa
commit 5c7d6da1c3
1 changed files with 0 additions and 2 deletions

View File

@ -84,7 +84,6 @@ gimp_config_type_register (GType parent_type,
g_return_val_if_fail (g_type_is_a (parent_type, G_TYPE_OBJECT), G_TYPE_NONE); g_return_val_if_fail (g_type_is_a (parent_type, G_TYPE_OBJECT), G_TYPE_NONE);
g_return_val_if_fail (type_name != NULL, G_TYPE_NONE); g_return_val_if_fail (type_name != NULL, G_TYPE_NONE);
g_return_val_if_fail (pspecs != NULL, G_TYPE_NONE); g_return_val_if_fail (pspecs != NULL, G_TYPE_NONE);
g_return_val_if_fail (n_pspecs > 0, G_TYPE_NONE);
terminated_pspecs = g_new0 (GParamSpec *, n_pspecs + 1); terminated_pspecs = g_new0 (GParamSpec *, n_pspecs + 1);
@ -115,7 +114,6 @@ gimp_config_type_register (GType parent_type,
config_type = g_type_register_static (parent_type, type_name, config_type = g_type_register_static (parent_type, type_name,
&info, 0); &info, 0);
g_type_add_interface_static (config_type, GIMP_TYPE_CONFIG, g_type_add_interface_static (config_type, GIMP_TYPE_CONFIG,
&config_info); &config_info);
} }