script-fu: use gimp_value_array_copy(), and free the copy
This commit is contained in:
@ -68,6 +68,7 @@ get_length (GimpProcedureConfig *config)
|
|||||||
|
|
||||||
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (config),
|
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (config),
|
||||||
&n_pspecs);
|
&n_pspecs);
|
||||||
|
g_free (pspecs);
|
||||||
g_debug ("length config: %d", n_pspecs);
|
g_debug ("length config: %d", n_pspecs);
|
||||||
g_free (pspecs);
|
g_free (pspecs);
|
||||||
return n_pspecs;
|
return n_pspecs;
|
||||||
@ -77,7 +78,8 @@ get_length (GimpProcedureConfig *config)
|
|||||||
from the config.
|
from the config.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
fill_gva_from (GimpProcedureConfig *config, GimpValueArray * gva)
|
fill_gva_from (GimpProcedureConfig *config,
|
||||||
|
GimpValueArray *gva)
|
||||||
{
|
{
|
||||||
GParamSpec **pspecs;
|
GParamSpec **pspecs;
|
||||||
guint n_pspecs;
|
guint n_pspecs;
|
||||||
@ -220,21 +222,16 @@ script_fu_dialog_run (GimpProcedure *procedure,
|
|||||||
|
|
||||||
if (not_canceled)
|
if (not_canceled)
|
||||||
{
|
{
|
||||||
/* initial_args is declared const.
|
GimpValueArray *final_args = gimp_value_array_copy (initial_args);
|
||||||
* To avoid compiler warning "discarding const"
|
|
||||||
* copy initial_args to a writeable copy.
|
|
||||||
*/
|
|
||||||
GimpValueArray *final_args = (GimpValueArray*) g_value_array_copy ((GValueArray*) initial_args);
|
|
||||||
/* FIXME the above is deprecated.
|
|
||||||
* Non-deprecated, but doesn't work:
|
|
||||||
* GimpValueArray *final_args = (GimpValueArray*) g_array_copy ((GArray*) initial_args);
|
|
||||||
* Maybe we need a gimp_value_array_copy method?
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Store config's values into final_args. */
|
/* Store config's values into final_args. */
|
||||||
gimp_procedure_config_get_values (config, final_args);
|
gimp_procedure_config_get_values (config, final_args);
|
||||||
|
|
||||||
result = script_fu_interpret_image_proc (procedure, script, image, n_drawables, drawables, final_args);
|
result = script_fu_interpret_image_proc (procedure, script,
|
||||||
|
image, n_drawables, drawables,
|
||||||
|
final_args);
|
||||||
|
|
||||||
|
gimp_value_array_unref (final_args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user