pdb: Set choice args to default in gimp-file-save
In gimp_file_save (), we clear out the values of any String parameters to prevent unexpected results. However, GimpChoice is also a String type. This causes the function to fail because empty string is not a valid option for GimpChoice. This patch adds a prior check if the argument is a GimpChoice, and sets it to its default value instead to prevent this issue.
This commit is contained in:
parent
21d834ec9b
commit
8021b46414
2 changed files with 22 additions and 4 deletions
|
|
@ -267,8 +267,17 @@ file_save_invoker (GimpProcedure *procedure,
|
|||
}
|
||||
|
||||
for (i = custom_args_start; i < proc->num_args; i++)
|
||||
if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
|
||||
g_value_set_static_string (gimp_value_array_index (new_args, i), "");
|
||||
if (GIMP_IS_PARAM_SPEC_CHOICE (proc->args[i]))
|
||||
{
|
||||
GParamSpecString *string_spec = G_PARAM_SPEC_STRING (proc->args[i]);
|
||||
|
||||
g_value_set_static_string (gimp_value_array_index (new_args, i),
|
||||
string_spec->default_value);
|
||||
}
|
||||
else if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
|
||||
{
|
||||
g_value_set_static_string (gimp_value_array_index (new_args, i), "");
|
||||
}
|
||||
|
||||
return_vals =
|
||||
gimp_pdb_execute_procedure_by_name_args (gimp->pdb,
|
||||
|
|
|
|||
|
|
@ -287,8 +287,17 @@ HELP
|
|||
}
|
||||
|
||||
for (i = custom_args_start; i < proc->num_args; i++)
|
||||
if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
|
||||
g_value_set_static_string (gimp_value_array_index (new_args, i), "");
|
||||
if (GIMP_IS_PARAM_SPEC_CHOICE (proc->args[i]))
|
||||
{
|
||||
GParamSpecString *string_spec = G_PARAM_SPEC_STRING (proc->args[i]);
|
||||
|
||||
g_value_set_static_string (gimp_value_array_index (new_args, i),
|
||||
string_spec->default_value);
|
||||
}
|
||||
else if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
|
||||
{
|
||||
g_value_set_static_string (gimp_value_array_index (new_args, i), "");
|
||||
}
|
||||
|
||||
return_vals =
|
||||
gimp_pdb_execute_procedure_by_name_args (gimp->pdb,
|
||||
|
|
|
|||
Loading…
Reference in a new issue