Issue #6033: fix calling gimp_pdb_run_procedure_argv() with no…

… arguments and allow creating empty GimpValueArray.
This commit is contained in:
Lloyd Konneker 2021-04-08 21:14:02 +00:00 committed by Jehan
parent b21865328c
commit cbce7b3a98
2 changed files with 12 additions and 8 deletions

View file

@ -281,10 +281,10 @@ gimp_pdb_run_procedure_valist (GimpPDB *pdb,
/**
* gimp_pdb_run_procedure_argv: (rename-to gimp_pdb_run_procedure)
* @pdb: the #GimpPDB object.
* @procedure_name: the procedure registered name.
* @arguments: (array length=n_arguments): the call arguments.
* @n_arguments: the number of arguments.
* @pdb: the #GimpPDB object.
* @procedure_name: the registered name to call.
* @arguments: (array length=n_arguments) (nullable): the call arguments or %NULL.
* @n_arguments: the number of arguments.
*
* Runs the procedure named @procedure_name with @arguments.
*
@ -303,7 +303,9 @@ gimp_pdb_run_procedure_argv (GimpPDB *pdb,
g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL);
g_return_val_if_fail (gimp_is_canonical_identifier (procedure_name), NULL);
g_return_val_if_fail (arguments != NULL, NULL);
/* Not require arguments != NULL.
* gimp_value_array_new_from_values(NULL, 0) will return empty GValueArray.
*/
args = gimp_value_array_new_from_values (arguments, n_arguments);
return_values = gimp_pdb_run_procedure_array (pdb, procedure_name, args);

View file

@ -256,7 +256,7 @@ gimp_value_array_new_from_types_valist (gchar **error_msg,
* @n_values: the number of value elements
*
* Allocate and initialize a new #GimpValueArray, and fill it with
* the given #GValues.
* the given #GValues. When no #GValues are given, returns empty #GimpValueArray.
*
* Returns: a newly allocated #GimpValueArray.
*
@ -269,8 +269,10 @@ gimp_value_array_new_from_values (const GValue *values,
GimpValueArray *value_array;
gint i;
g_return_val_if_fail (values != NULL, NULL);
g_return_val_if_fail (n_values > 0, NULL);
/* n_values is zero if and only if values is NULL. */
g_return_val_if_fail ((n_values == 0 && values == NULL) ||
(n_values > 0 && values != NULL),
NULL);
value_array = gimp_value_array_new (n_values);