app/plug-in/gimppluginprocedure.c don't just free the return values when

2008-08-21  Sven Neumann  <sven@gimp.org>

	* app/plug-in/gimppluginprocedure.c
	* app/plug-in/gimptemporaryprocedure.c: don't just free the 
return
	values when running procedures asynchronously. Instead examine
	them and display the error message if there's one.

	* app/plug-in/gimppluginmanager-call.c
	(gimp_plug_in_manager_call_run_temp): return NULL if
	procedure->plug_in is not set.

	* app/plug-in/gimpplugin-message.c: comment.


svn path=/trunk/; revision=26700
This commit is contained in:
Sven Neumann 2008-08-21 16:27:06 +00:00 committed by Sven Neumann
parent 3f37605f34
commit 5e95e896b1
5 changed files with 85 additions and 16 deletions

View File

@ -1,3 +1,16 @@
2008-08-21 Sven Neumann <sven@gimp.org>
* app/plug-in/gimppluginprocedure.c
* app/plug-in/gimptemporaryprocedure.c: don't just free the return
values when running procedures asynchronously. Instead examine
them and display the error message if there's one.
* app/plug-in/gimppluginmanager-call.c
(gimp_plug_in_manager_call_run_temp): return NULL if
procedure->plug_in is not set.
* app/plug-in/gimpplugin-message.c: comment.
2008-08-21 Michael Natterer <mitch@gimp.org>
* configure.in: removed indentation from blocks after

View File

@ -436,7 +436,7 @@ gimp_plug_in_handle_proc_error (GimpPlugIn *plug_in,
break;
case GIMP_PDB_ERROR_HANDLER_PLUGIN:
/* the plug-in is responsible for this error */
/* the plug-in is responsible for handling this error */
break;
}
}

View File

@ -289,7 +289,8 @@ gimp_plug_in_manager_call_run_temp (GimpPlugInManager *manager,
GimpTemporaryProcedure *procedure,
GValueArray *args)
{
GimpPlugIn *plug_in;
GValueArray *return_vals = NULL;
GimpPlugIn *plug_in;
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
@ -302,7 +303,6 @@ gimp_plug_in_manager_call_run_temp (GimpPlugInManager *manager,
if (plug_in)
{
GimpPlugInProcFrame *proc_frame;
GValueArray *return_vals;
GPProcRun proc_run;
proc_frame = gimp_plug_in_proc_frame_push (plug_in, context, progress,
@ -346,13 +346,7 @@ gimp_plug_in_manager_call_run_temp (GimpPlugInManager *manager,
gimp_plug_in_proc_frame_unref (proc_frame, plug_in);
g_object_unref (plug_in);
}
return return_vals;
}
else
{
/* can we actually ever get here? */
return gimp_procedure_get_return_values (GIMP_PROCEDURE (procedure),
FALSE, NULL);
}
return return_vals;
}

View File

@ -231,11 +231,40 @@ gimp_plug_in_procedure_execute_async (GimpProcedure *procedure,
plug_in_procedure,
args, FALSE, display);
/* In case of errors, gimp_plug_in_manager_call_run() may return
* return_vals, even if run asynchronously.
*/
if (return_vals)
g_value_array_free (return_vals);
{
switch (g_value_get_enum (&return_vals->values[0]))
{
case GIMP_PDB_SUCCESS:
break;
case GIMP_PDB_CALLING_ERROR:
if (return_vals->n_values > 1 &&
G_VALUE_HOLDS_STRING (&return_vals->values[1]))
{
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
_("Calling error for procedure '%s':\n"
"%s"),
gimp_object_get_name (GIMP_OBJECT (procedure)),
g_value_get_string (&return_vals->values[1]));
}
break;
case GIMP_PDB_EXECUTION_ERROR:
if (return_vals->n_values > 1 &&
G_VALUE_HOLDS_STRING (&return_vals->values[1]))
{
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
_("Execution error for procedure '%s':\n"
"%s"),
gimp_object_get_name (GIMP_OBJECT (procedure)),
g_value_get_string (&return_vals->values[1]));
}
break;
}
g_value_array_free (return_vals);
}
}
const gchar *

View File

@ -116,7 +116,40 @@ gimp_temporary_procedure_execute_async (GimpProcedure *procedure,
GIMP_TEMPORARY_PROCEDURE (procedure),
args);
g_value_array_free (return_vals);
if (return_vals)
{
switch (g_value_get_enum (&return_vals->values[0]))
{
case GIMP_PDB_SUCCESS:
break;
case GIMP_PDB_CALLING_ERROR:
if (return_vals->n_values > 1 &&
G_VALUE_HOLDS_STRING (&return_vals->values[1]))
{
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
_("Calling error for procedure '%s':\n"
"%s"),
gimp_object_get_name (GIMP_OBJECT (procedure)),
g_value_get_string (&return_vals->values[1]));
}
break;
case GIMP_PDB_EXECUTION_ERROR:
if (return_vals->n_values > 1 &&
G_VALUE_HOLDS_STRING (&return_vals->values[1]))
{
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
_("Execution error for procedure '%s':\n"
"%s"),
gimp_object_get_name (GIMP_OBJECT (procedure)),
g_value_get_string (&return_vals->values[1]));
}
break;
}
g_value_array_free (return_vals);
}
}
const gchar *