mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-20 11:37:14 +00:00
changed member "ProcRec *current_temp_proc" to "GList *temp_proc_recs", a
2004-01-20 Michael Natterer <mitch@gimp.org> * app/plug-in/plug-in.[ch]: changed member "ProcRec *current_temp_proc" to "GList *temp_proc_recs", a stack of temporary procedures, just as the "temp_main_loops" member is supposed to be the stack of main loops for waiting for the temp_procs' return values. * app/plug-in/plug-in-run.c (plug_in_temp_run): changed accordingly. * app/plug-in/plug-in-message.c * app/plug-in/plug-in-run.c * libgimp/gimp.c: added #define ENABLE_TEMP_RETURN 1. Enables return values for temporary procedures. On the libgimp side, this just enables the code which returns the values, on the app side it enables per-plug-in stacks of proc_recs and main_loops and a message handler for the GP_TEMP_PROC_RETURN message. A temp_proc's caller now blocks until the proc is finished. Fixes bug #50649. Left the #ifdefs there so it can be easily disabled if things break. Please play with Script-Fu and test this.
This commit is contained in:
parent
85d30877d2
commit
e8b27df097
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
2004-01-20 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/plug-in/plug-in.[ch]: changed member
|
||||
"ProcRec *current_temp_proc" to "GList *temp_proc_recs", a stack
|
||||
of temporary procedures, just as the "temp_main_loops" member is
|
||||
supposed to be the stack of main loops for waiting for the
|
||||
temp_procs' return values.
|
||||
|
||||
* app/plug-in/plug-in-run.c (plug_in_temp_run): changed accordingly.
|
||||
|
||||
* app/plug-in/plug-in-message.c
|
||||
* app/plug-in/plug-in-run.c
|
||||
* libgimp/gimp.c: added #define ENABLE_TEMP_RETURN 1.
|
||||
|
||||
Enables return values for temporary procedures. On the libgimp
|
||||
side, this just enables the code which returns the values, on the
|
||||
app side it enables per-plug-in stacks of proc_recs and main_loops
|
||||
and a message handler for the GP_TEMP_PROC_RETURN message.
|
||||
A temp_proc's caller now blocks until the proc is finished.
|
||||
Fixes bug #50649.
|
||||
|
||||
Left the #ifdefs there so it can be easily disabled if things
|
||||
break. Please play with Script-Fu and test this.
|
||||
|
||||
2004-01-19 Pedro Gimeno <pggimeno@wanadoo.es>
|
||||
|
||||
* plug-ins/common/ccanalyze.c (analyze): Call gimp_drawable_detach()
|
||||
|
|
|
@ -42,6 +42,9 @@
|
|||
#include "plug-in-shm.h"
|
||||
|
||||
|
||||
#define ENABLE_TEMP_RETURN 1
|
||||
|
||||
|
||||
typedef struct _PlugInBlocked PlugInBlocked;
|
||||
|
||||
struct _PlugInBlocked
|
||||
|
|
|
@ -268,11 +268,12 @@ plug_in_new (Gimp *gimp,
|
|||
plug_in->write_buffer_index = 0;
|
||||
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
plug_in->current_temp_proc = NULL;
|
||||
|
||||
plug_in->ext_main_loop = NULL;
|
||||
plug_in->recurse_main_loop = NULL;
|
||||
|
||||
plug_in->temp_main_loops = NULL;
|
||||
plug_in->temp_proc_recs = NULL;
|
||||
|
||||
plug_in->return_vals = NULL;
|
||||
plug_in->n_return_vals = 0;
|
||||
|
@ -873,9 +874,9 @@ plug_in_get_undo_desc (PlugIn *plug_in)
|
|||
|
||||
g_return_val_if_fail (plug_in != NULL, NULL);
|
||||
|
||||
if (plug_in->current_temp_proc)
|
||||
if (plug_in->temp_proc_recs)
|
||||
proc_def = plug_ins_proc_def_find (plug_in->gimp,
|
||||
plug_in->current_temp_proc);
|
||||
plug_in->temp_proc_recs->data);
|
||||
else if (plug_in->proc_rec)
|
||||
proc_def = plug_ins_proc_def_find (plug_in->gimp,
|
||||
plug_in->proc_rec);
|
||||
|
|
|
@ -54,11 +54,12 @@ struct _PlugIn
|
|||
gint write_buffer_index; /* Buffer index for writing */
|
||||
|
||||
GSList *temp_proc_defs; /* Temporary procedures */
|
||||
ProcRecord *current_temp_proc;/* The temp proc the plug-in is busy with */
|
||||
|
||||
GMainLoop *ext_main_loop; /* for waiting for extension_ack */
|
||||
GMainLoop *recurse_main_loop;/* for waiting for proc_return */
|
||||
|
||||
GList *temp_main_loops; /* for waiting for temp_proc_returns */
|
||||
GList *temp_proc_recs; /* The temp procs the plug-in is busy with */
|
||||
|
||||
Argument *return_vals; /* The return value we wait for */
|
||||
gint n_return_vals;
|
||||
|
|
|
@ -211,6 +211,8 @@ plug_in_repeat (Gimp *gimp,
|
|||
|
||||
/* private functions */
|
||||
|
||||
#define ENABLE_TEMP_RETURN 1
|
||||
|
||||
static Argument *
|
||||
plug_in_temp_run (ProcRecord *proc_rec,
|
||||
Argument *args,
|
||||
|
@ -225,13 +227,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
{
|
||||
GPProcRun proc_run;
|
||||
|
||||
if (plug_in->current_temp_proc)
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
}
|
||||
|
||||
plug_in->current_temp_proc = proc_rec;
|
||||
plug_in->temp_proc_recs = g_list_prepend (plug_in->temp_proc_recs,
|
||||
proc_rec);
|
||||
|
||||
proc_run.name = proc_rec->name;
|
||||
proc_run.nparams = argc;
|
||||
|
@ -241,6 +238,10 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
|
||||
plug_in->temp_proc_recs = g_list_remove (plug_in->temp_proc_recs,
|
||||
proc_rec);
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -256,7 +257,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
return_vals = procedural_db_return_args (proc_rec, TRUE);
|
||||
#endif
|
||||
|
||||
plug_in->current_temp_proc = NULL;
|
||||
plug_in->temp_proc_recs = g_list_remove (plug_in->temp_proc_recs,
|
||||
proc_rec);
|
||||
|
||||
plug_in_unref (plug_in);
|
||||
}
|
||||
|
|
|
@ -211,6 +211,8 @@ plug_in_repeat (Gimp *gimp,
|
|||
|
||||
/* private functions */
|
||||
|
||||
#define ENABLE_TEMP_RETURN 1
|
||||
|
||||
static Argument *
|
||||
plug_in_temp_run (ProcRecord *proc_rec,
|
||||
Argument *args,
|
||||
|
@ -225,13 +227,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
{
|
||||
GPProcRun proc_run;
|
||||
|
||||
if (plug_in->current_temp_proc)
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
}
|
||||
|
||||
plug_in->current_temp_proc = proc_rec;
|
||||
plug_in->temp_proc_recs = g_list_prepend (plug_in->temp_proc_recs,
|
||||
proc_rec);
|
||||
|
||||
proc_run.name = proc_rec->name;
|
||||
proc_run.nparams = argc;
|
||||
|
@ -241,6 +238,10 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
|
||||
plug_in->temp_proc_recs = g_list_remove (plug_in->temp_proc_recs,
|
||||
proc_rec);
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -256,7 +257,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
return_vals = procedural_db_return_args (proc_rec, TRUE);
|
||||
#endif
|
||||
|
||||
plug_in->current_temp_proc = NULL;
|
||||
plug_in->temp_proc_recs = g_list_remove (plug_in->temp_proc_recs,
|
||||
proc_rec);
|
||||
|
||||
plug_in_unref (plug_in);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,9 @@
|
|||
#include "plug-in-shm.h"
|
||||
|
||||
|
||||
#define ENABLE_TEMP_RETURN 1
|
||||
|
||||
|
||||
typedef struct _PlugInBlocked PlugInBlocked;
|
||||
|
||||
struct _PlugInBlocked
|
||||
|
|
|
@ -211,6 +211,8 @@ plug_in_repeat (Gimp *gimp,
|
|||
|
||||
/* private functions */
|
||||
|
||||
#define ENABLE_TEMP_RETURN 1
|
||||
|
||||
static Argument *
|
||||
plug_in_temp_run (ProcRecord *proc_rec,
|
||||
Argument *args,
|
||||
|
@ -225,13 +227,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
{
|
||||
GPProcRun proc_run;
|
||||
|
||||
if (plug_in->current_temp_proc)
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
goto done;
|
||||
}
|
||||
|
||||
plug_in->current_temp_proc = proc_rec;
|
||||
plug_in->temp_proc_recs = g_list_prepend (plug_in->temp_proc_recs,
|
||||
proc_rec);
|
||||
|
||||
proc_run.name = proc_rec->name;
|
||||
proc_run.nparams = argc;
|
||||
|
@ -241,6 +238,10 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
! wire_flush (plug_in->my_write, plug_in))
|
||||
{
|
||||
return_vals = procedural_db_return_args (proc_rec, FALSE);
|
||||
|
||||
plug_in->temp_proc_recs = g_list_remove (plug_in->temp_proc_recs,
|
||||
proc_rec);
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -256,7 +257,8 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
return_vals = procedural_db_return_args (proc_rec, TRUE);
|
||||
#endif
|
||||
|
||||
plug_in->current_temp_proc = NULL;
|
||||
plug_in->temp_proc_recs = g_list_remove (plug_in->temp_proc_recs,
|
||||
proc_rec);
|
||||
|
||||
plug_in_unref (plug_in);
|
||||
}
|
||||
|
|
|
@ -268,11 +268,12 @@ plug_in_new (Gimp *gimp,
|
|||
plug_in->write_buffer_index = 0;
|
||||
|
||||
plug_in->temp_proc_defs = NULL;
|
||||
plug_in->current_temp_proc = NULL;
|
||||
|
||||
plug_in->ext_main_loop = NULL;
|
||||
plug_in->recurse_main_loop = NULL;
|
||||
|
||||
plug_in->temp_main_loops = NULL;
|
||||
plug_in->temp_proc_recs = NULL;
|
||||
|
||||
plug_in->return_vals = NULL;
|
||||
plug_in->n_return_vals = 0;
|
||||
|
@ -873,9 +874,9 @@ plug_in_get_undo_desc (PlugIn *plug_in)
|
|||
|
||||
g_return_val_if_fail (plug_in != NULL, NULL);
|
||||
|
||||
if (plug_in->current_temp_proc)
|
||||
if (plug_in->temp_proc_recs)
|
||||
proc_def = plug_ins_proc_def_find (plug_in->gimp,
|
||||
plug_in->current_temp_proc);
|
||||
plug_in->temp_proc_recs->data);
|
||||
else if (plug_in->proc_rec)
|
||||
proc_def = plug_ins_proc_def_find (plug_in->gimp,
|
||||
plug_in->proc_rec);
|
||||
|
|
|
@ -54,11 +54,12 @@ struct _PlugIn
|
|||
gint write_buffer_index; /* Buffer index for writing */
|
||||
|
||||
GSList *temp_proc_defs; /* Temporary procedures */
|
||||
ProcRecord *current_temp_proc;/* The temp proc the plug-in is busy with */
|
||||
|
||||
GMainLoop *ext_main_loop; /* for waiting for extension_ack */
|
||||
GMainLoop *recurse_main_loop;/* for waiting for proc_return */
|
||||
|
||||
GList *temp_main_loops; /* for waiting for temp_proc_returns */
|
||||
GList *temp_proc_recs; /* The temp procs the plug-in is busy with */
|
||||
|
||||
Argument *return_vals; /* The return value we wait for */
|
||||
gint n_return_vals;
|
||||
|
|
|
@ -1729,6 +1729,10 @@ gimp_proc_run (GPProcRun *proc_run)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#define ENABLE_TEMP_RETURN 1
|
||||
|
||||
|
||||
static void
|
||||
gimp_temp_proc_run (GPProcRun *proc_run)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue