mirror of https://github.com/GNOME/gimp.git
plug-ins/script-fu/script-fu-scripts.c (script_fu_free_script) plugged
2005-01-15 Sven Neumann <sven@gimp.org> * plug-ins/script-fu/script-fu-scripts.c (script_fu_free_script) * plug-ins/script-fu/siod-wrapper.c (init_procedures): plugged memory leaks.
This commit is contained in:
parent
bb3a6002cf
commit
09a190f132
|
@ -1,3 +1,9 @@
|
|||
2005-01-15 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/script-fu/script-fu-scripts.c (script_fu_free_script)
|
||||
* plug-ins/script-fu/siod-wrapper.c (init_procedures): plugged
|
||||
memory leaks.
|
||||
|
||||
2005-01-15 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpitemtreeview.c
|
||||
|
|
|
@ -194,8 +194,6 @@ static void
|
|||
init_procedures (void)
|
||||
{
|
||||
gchar **proc_list;
|
||||
gchar *proc_name;
|
||||
gchar *arg_name;
|
||||
gchar *proc_blurb;
|
||||
gchar *proc_help;
|
||||
gchar *proc_author;
|
||||
|
@ -221,10 +219,8 @@ init_procedures (void)
|
|||
/* Register each procedure as a scheme func */
|
||||
for (i = 0; i < num_procs; i++)
|
||||
{
|
||||
proc_name = g_strdup (proc_list[i]);
|
||||
|
||||
/* lookup the procedure */
|
||||
if (gimp_procedural_db_proc_info (proc_name,
|
||||
if (gimp_procedural_db_proc_info (proc_list[i],
|
||||
&proc_blurb,
|
||||
&proc_help,
|
||||
&proc_author,
|
||||
|
@ -234,33 +230,37 @@ init_procedures (void)
|
|||
&nparams, &nreturn_vals,
|
||||
¶ms, &return_vals))
|
||||
{
|
||||
LISP args = NIL;
|
||||
LISP code = NIL;
|
||||
gint j;
|
||||
|
||||
/* convert the names to scheme-like naming conventions */
|
||||
convert_string (proc_name);
|
||||
LISP args = NIL;
|
||||
LISP code = NIL;
|
||||
gchar *proc_name;
|
||||
gint j;
|
||||
|
||||
/* create a new scheme func that calls gimp-proc-db-call */
|
||||
for (j = 0; j < nparams; j++)
|
||||
{
|
||||
arg_name = g_strdup (params[j].name);
|
||||
gchar *arg_name = params[j].name;
|
||||
|
||||
convert_string (arg_name);
|
||||
args = cons (cintern (arg_name), args);
|
||||
code = cons (cintern (arg_name), code);
|
||||
|
||||
args = cons (rintern (arg_name), args);
|
||||
code = cons (rintern (arg_name), code);
|
||||
}
|
||||
|
||||
/* reverse the list */
|
||||
args = nreverse (args);
|
||||
code = nreverse (code);
|
||||
|
||||
/* set the scheme-based procedure name */
|
||||
args = cons (cintern (proc_name), args);
|
||||
/* convert the procedure name to scheme-like naming conventions */
|
||||
proc_name = g_strdup (proc_list[i]);
|
||||
convert_string (proc_name);
|
||||
|
||||
/* set the acture pdb procedure name */
|
||||
/* set the scheme-based procedure name */
|
||||
args = cons (rintern (proc_name), args);
|
||||
g_free (proc_name);
|
||||
|
||||
/* set the actual pdb procedure name */
|
||||
code = cons (cons (cintern ("quote"),
|
||||
cons (cintern (proc_list[i]), NIL)),
|
||||
code);
|
||||
cons (rintern (proc_list[i]), NIL)), code);
|
||||
code = cons (cintern ("gimp-proc-db-call"), code);
|
||||
|
||||
leval_define (cons (args, cons (code, NIL)), NIL);
|
||||
|
@ -271,9 +271,12 @@ init_procedures (void)
|
|||
g_free (proc_author);
|
||||
g_free (proc_copyright);
|
||||
g_free (proc_date);
|
||||
|
||||
gimp_destroy_paramdefs (params, nparams);
|
||||
gimp_destroy_paramdefs (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
g_free (proc_list[i]);
|
||||
}
|
||||
|
||||
g_free (proc_list);
|
||||
|
|
|
@ -918,90 +918,90 @@ script_fu_free_script (SFScript *script)
|
|||
{
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (script != NULL);
|
||||
|
||||
/* Uninstall the temporary procedure for this script */
|
||||
gimp_uninstall_temp_proc (script->pdb_name);
|
||||
|
||||
if (script)
|
||||
g_free (script->pdb_name);
|
||||
g_free (script->script_name);
|
||||
g_free (script->menu_path);
|
||||
g_free (script->help);
|
||||
g_free (script->author);
|
||||
g_free (script->copyright);
|
||||
g_free (script->date);
|
||||
g_free (script->img_types);
|
||||
|
||||
for (i = 0; i < script->num_args; i++)
|
||||
{
|
||||
g_free (script->script_name);
|
||||
g_free (script->menu_path);
|
||||
g_free (script->help);
|
||||
g_free (script->author);
|
||||
g_free (script->copyright);
|
||||
g_free (script->date);
|
||||
g_free (script->img_types);
|
||||
g_free (script->arg_labels[i]);
|
||||
switch (script->arg_types[i])
|
||||
{
|
||||
case SF_IMAGE:
|
||||
case SF_DRAWABLE:
|
||||
case SF_LAYER:
|
||||
case SF_CHANNEL:
|
||||
case SF_COLOR:
|
||||
break;
|
||||
|
||||
for (i = 0; i < script->num_args; i++)
|
||||
{
|
||||
g_free (script->arg_labels[i]);
|
||||
switch (script->arg_types[i])
|
||||
{
|
||||
case SF_IMAGE:
|
||||
case SF_DRAWABLE:
|
||||
case SF_LAYER:
|
||||
case SF_CHANNEL:
|
||||
case SF_COLOR:
|
||||
break;
|
||||
case SF_VALUE:
|
||||
case SF_STRING:
|
||||
case SF_TEXT:
|
||||
g_free (script->arg_defaults[i].sfa_value);
|
||||
g_free (script->arg_values[i].sfa_value);
|
||||
break;
|
||||
|
||||
case SF_VALUE:
|
||||
case SF_STRING:
|
||||
case SF_TEXT:
|
||||
g_free (script->arg_defaults[i].sfa_value);
|
||||
g_free (script->arg_values[i].sfa_value);
|
||||
break;
|
||||
case SF_ADJUSTMENT:
|
||||
break;
|
||||
|
||||
case SF_ADJUSTMENT:
|
||||
break;
|
||||
case SF_FILENAME:
|
||||
case SF_DIRNAME:
|
||||
g_free (script->arg_defaults[i].sfa_file.filename);
|
||||
g_free (script->arg_values[i].sfa_file.filename);
|
||||
break;
|
||||
|
||||
case SF_FILENAME:
|
||||
case SF_DIRNAME:
|
||||
g_free (script->arg_defaults[i].sfa_file.filename);
|
||||
g_free (script->arg_values[i].sfa_file.filename);
|
||||
break;
|
||||
case SF_FONT:
|
||||
g_free (script->arg_defaults[i].sfa_font);
|
||||
g_free (script->arg_values[i].sfa_font);
|
||||
break;
|
||||
|
||||
case SF_FONT:
|
||||
g_free (script->arg_defaults[i].sfa_font);
|
||||
g_free (script->arg_values[i].sfa_font);
|
||||
break;
|
||||
case SF_PALETTE:
|
||||
g_free (script->arg_defaults[i].sfa_palette);
|
||||
g_free (script->arg_values[i].sfa_palette);
|
||||
break;
|
||||
|
||||
case SF_PALETTE:
|
||||
g_free (script->arg_defaults[i].sfa_palette);
|
||||
g_free (script->arg_values[i].sfa_palette);
|
||||
break;
|
||||
case SF_PATTERN:
|
||||
g_free (script->arg_defaults[i].sfa_pattern);
|
||||
g_free (script->arg_values[i].sfa_pattern);
|
||||
break;
|
||||
|
||||
case SF_PATTERN:
|
||||
g_free (script->arg_defaults[i].sfa_pattern);
|
||||
g_free (script->arg_values[i].sfa_pattern);
|
||||
break;
|
||||
case SF_GRADIENT:
|
||||
g_free (script->arg_defaults[i].sfa_gradient);
|
||||
g_free (script->arg_values[i].sfa_gradient);
|
||||
break;
|
||||
|
||||
case SF_GRADIENT:
|
||||
g_free (script->arg_defaults[i].sfa_gradient);
|
||||
g_free (script->arg_values[i].sfa_gradient);
|
||||
break;
|
||||
case SF_BRUSH:
|
||||
g_free (script->arg_defaults[i].sfa_brush.name);
|
||||
g_free (script->arg_values[i].sfa_brush.name);
|
||||
break;
|
||||
|
||||
case SF_BRUSH:
|
||||
g_free (script->arg_defaults[i].sfa_brush.name);
|
||||
g_free (script->arg_values[i].sfa_brush.name);
|
||||
break;
|
||||
case SF_OPTION:
|
||||
g_slist_foreach (script->arg_defaults[i].sfa_option.list,
|
||||
(GFunc) g_free, NULL);
|
||||
g_slist_free (script->arg_defaults[i].sfa_option.list);
|
||||
break;
|
||||
|
||||
case SF_OPTION:
|
||||
g_slist_foreach (script->arg_defaults[i].sfa_option.list,
|
||||
(GFunc) g_free, NULL);
|
||||
g_slist_free (script->arg_defaults[i].sfa_option.list);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (script->arg_labels);
|
||||
g_free (script->arg_defaults);
|
||||
g_free (script->arg_types);
|
||||
g_free (script->arg_values);
|
||||
|
||||
g_free (script);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (script->arg_labels);
|
||||
g_free (script->arg_defaults);
|
||||
g_free (script->arg_types);
|
||||
g_free (script->arg_values);
|
||||
|
||||
g_free (script);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
|
|
@ -194,8 +194,6 @@ static void
|
|||
init_procedures (void)
|
||||
{
|
||||
gchar **proc_list;
|
||||
gchar *proc_name;
|
||||
gchar *arg_name;
|
||||
gchar *proc_blurb;
|
||||
gchar *proc_help;
|
||||
gchar *proc_author;
|
||||
|
@ -221,10 +219,8 @@ init_procedures (void)
|
|||
/* Register each procedure as a scheme func */
|
||||
for (i = 0; i < num_procs; i++)
|
||||
{
|
||||
proc_name = g_strdup (proc_list[i]);
|
||||
|
||||
/* lookup the procedure */
|
||||
if (gimp_procedural_db_proc_info (proc_name,
|
||||
if (gimp_procedural_db_proc_info (proc_list[i],
|
||||
&proc_blurb,
|
||||
&proc_help,
|
||||
&proc_author,
|
||||
|
@ -234,33 +230,37 @@ init_procedures (void)
|
|||
&nparams, &nreturn_vals,
|
||||
¶ms, &return_vals))
|
||||
{
|
||||
LISP args = NIL;
|
||||
LISP code = NIL;
|
||||
gint j;
|
||||
|
||||
/* convert the names to scheme-like naming conventions */
|
||||
convert_string (proc_name);
|
||||
LISP args = NIL;
|
||||
LISP code = NIL;
|
||||
gchar *proc_name;
|
||||
gint j;
|
||||
|
||||
/* create a new scheme func that calls gimp-proc-db-call */
|
||||
for (j = 0; j < nparams; j++)
|
||||
{
|
||||
arg_name = g_strdup (params[j].name);
|
||||
gchar *arg_name = params[j].name;
|
||||
|
||||
convert_string (arg_name);
|
||||
args = cons (cintern (arg_name), args);
|
||||
code = cons (cintern (arg_name), code);
|
||||
|
||||
args = cons (rintern (arg_name), args);
|
||||
code = cons (rintern (arg_name), code);
|
||||
}
|
||||
|
||||
/* reverse the list */
|
||||
args = nreverse (args);
|
||||
code = nreverse (code);
|
||||
|
||||
/* set the scheme-based procedure name */
|
||||
args = cons (cintern (proc_name), args);
|
||||
/* convert the procedure name to scheme-like naming conventions */
|
||||
proc_name = g_strdup (proc_list[i]);
|
||||
convert_string (proc_name);
|
||||
|
||||
/* set the acture pdb procedure name */
|
||||
/* set the scheme-based procedure name */
|
||||
args = cons (rintern (proc_name), args);
|
||||
g_free (proc_name);
|
||||
|
||||
/* set the actual pdb procedure name */
|
||||
code = cons (cons (cintern ("quote"),
|
||||
cons (cintern (proc_list[i]), NIL)),
|
||||
code);
|
||||
cons (rintern (proc_list[i]), NIL)), code);
|
||||
code = cons (cintern ("gimp-proc-db-call"), code);
|
||||
|
||||
leval_define (cons (args, cons (code, NIL)), NIL);
|
||||
|
@ -271,9 +271,12 @@ init_procedures (void)
|
|||
g_free (proc_author);
|
||||
g_free (proc_copyright);
|
||||
g_free (proc_date);
|
||||
|
||||
gimp_destroy_paramdefs (params, nparams);
|
||||
gimp_destroy_paramdefs (return_vals, nreturn_vals);
|
||||
}
|
||||
|
||||
g_free (proc_list[i]);
|
||||
}
|
||||
|
||||
g_free (proc_list);
|
||||
|
|
Loading…
Reference in New Issue