mirror of https://github.com/GNOME/gimp.git
added "gint ref_count" to the PlugInProcFrame struct. Added new functions
2004-12-14 Michael Natterer <mitch@gimp.org> * app/plug-in/plug-in-proc-frame.[ch]: added "gint ref_count" to the PlugInProcFrame struct. Added new functions plug_in_proc_frame_ref/unref(). (plug_in_proc_frame_new): set the ref_count to 1. * app/plug-in/plug-in.[ch] (plug_in_proc_frame_push): return the new proc_frame. (plug_in_proc_frame_pop): use unref() instead of free(). * app/plug-in/plug-in-run.c (plug_in_temp_run): ref the proc_frame while running its main loop. Removed the call to plug_in_proc_frame_pop(). * app/plug-in/plug-in-message.c (plug_in_handle_temp_proc_return): call plug_in_proc_frame_pop() immediately after plug_in_main_loop_quit() so the proc_frame goes away from the stack and can't be used accidentially if the core is too busy to return to the main loop before the next command arrives on the wire. Really fixes bug #161114 this time.
This commit is contained in:
parent
7323c5a07d
commit
0449deee27
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
2004-12-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/plug-in/plug-in-proc-frame.[ch]: added "gint ref_count" to
|
||||
the PlugInProcFrame struct. Added new functions
|
||||
plug_in_proc_frame_ref/unref().
|
||||
|
||||
(plug_in_proc_frame_new): set the ref_count to 1.
|
||||
|
||||
* app/plug-in/plug-in.[ch] (plug_in_proc_frame_push): return the
|
||||
new proc_frame.
|
||||
|
||||
(plug_in_proc_frame_pop): use unref() instead of free().
|
||||
|
||||
* app/plug-in/plug-in-run.c (plug_in_temp_run): ref the proc_frame
|
||||
while running its main loop. Removed the call to
|
||||
plug_in_proc_frame_pop().
|
||||
|
||||
* app/plug-in/plug-in-message.c (plug_in_handle_temp_proc_return):
|
||||
call plug_in_proc_frame_pop() immediately after
|
||||
plug_in_main_loop_quit() so the proc_frame goes away from the
|
||||
stack and can't be used accidentially if the core is too busy to
|
||||
return to the main loop before the next command arrives on the
|
||||
wire. Really fixes bug #161114 this time.
|
||||
|
||||
2004-12-14 Simon Budig <simon@gimp.org>
|
||||
|
||||
* app/vectors/gimpstroke.[ch]: Changed the "gradient" parameter
|
||||
|
|
|
@ -550,6 +550,7 @@ plug_in_handle_temp_proc_return (PlugIn *plug_in,
|
|||
plug_in_handle_proc_return_priv (plug_in, proc_return, TRUE);
|
||||
|
||||
plug_in_main_loop_quit (plug_in);
|
||||
plug_in_proc_frame_pop (plug_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -878,7 +878,7 @@ plug_in_get_proc_frame (PlugIn *plug_in)
|
|||
return &plug_in->main_proc_frame;
|
||||
}
|
||||
|
||||
void
|
||||
PlugInProcFrame *
|
||||
plug_in_proc_frame_push (PlugIn *plug_in,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
|
@ -886,15 +886,17 @@ plug_in_proc_frame_push (PlugIn *plug_in,
|
|||
{
|
||||
PlugInProcFrame *proc_frame;
|
||||
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
|
||||
g_return_if_fail (proc_rec != NULL);
|
||||
g_return_val_if_fail (plug_in != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
|
||||
g_return_val_if_fail (proc_rec != NULL, NULL);
|
||||
|
||||
proc_frame = plug_in_proc_frame_new (context, progress, proc_rec);
|
||||
|
||||
plug_in->temp_proc_frames = g_list_prepend (plug_in->temp_proc_frames,
|
||||
proc_frame);
|
||||
|
||||
return proc_frame;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -907,7 +909,7 @@ plug_in_proc_frame_pop (PlugIn *plug_in)
|
|||
|
||||
proc_frame = (PlugInProcFrame *) plug_in->temp_proc_frames->data;
|
||||
|
||||
plug_in_proc_frame_free (proc_frame, plug_in);
|
||||
plug_in_proc_frame_unref (proc_frame, plug_in);
|
||||
|
||||
plug_in->temp_proc_frames = g_list_remove (plug_in->temp_proc_frames,
|
||||
proc_frame);
|
||||
|
|
|
@ -97,7 +97,7 @@ void plug_in_pop (Gimp *gimp);
|
|||
|
||||
PlugInProcFrame * plug_in_get_proc_frame (PlugIn *plug_in);
|
||||
|
||||
void plug_in_proc_frame_push (PlugIn *plug_in,
|
||||
PlugInProcFrame * plug_in_proc_frame_push (PlugIn *plug_in,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
ProcRecord *proc_rec);
|
||||
|
|
|
@ -250,9 +250,11 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
|
||||
if (plug_in)
|
||||
{
|
||||
GPProcRun proc_run;
|
||||
PlugInProcFrame *proc_frame;
|
||||
GPProcRun proc_run;
|
||||
|
||||
plug_in_proc_frame_push (plug_in, context, progress, proc_rec);
|
||||
proc_frame = plug_in_proc_frame_push (plug_in, context, progress,
|
||||
proc_rec);
|
||||
|
||||
proc_run.name = proc_rec->name;
|
||||
proc_run.nparams = argc;
|
||||
|
@ -271,14 +273,17 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
plug_in_params_destroy (proc_run.params, proc_run.nparams, FALSE);
|
||||
|
||||
plug_in_ref (plug_in);
|
||||
plug_in_proc_frame_ref (proc_frame);
|
||||
|
||||
plug_in_main_loop (plug_in);
|
||||
|
||||
return_vals = plug_in_get_return_vals (plug_in,
|
||||
plug_in->temp_proc_frames->data);
|
||||
return_vals = plug_in_get_return_vals (plug_in, proc_frame);
|
||||
|
||||
plug_in_proc_frame_pop (plug_in);
|
||||
/* main_loop is quit and proc_frame is popped in
|
||||
* plug_in_handle_temp_proc_return()
|
||||
*/
|
||||
|
||||
plug_in_proc_frame_unref (proc_frame, plug_in);
|
||||
plug_in_unref (plug_in);
|
||||
}
|
||||
|
||||
|
|
|
@ -250,9 +250,11 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
|
||||
if (plug_in)
|
||||
{
|
||||
GPProcRun proc_run;
|
||||
PlugInProcFrame *proc_frame;
|
||||
GPProcRun proc_run;
|
||||
|
||||
plug_in_proc_frame_push (plug_in, context, progress, proc_rec);
|
||||
proc_frame = plug_in_proc_frame_push (plug_in, context, progress,
|
||||
proc_rec);
|
||||
|
||||
proc_run.name = proc_rec->name;
|
||||
proc_run.nparams = argc;
|
||||
|
@ -271,14 +273,17 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
plug_in_params_destroy (proc_run.params, proc_run.nparams, FALSE);
|
||||
|
||||
plug_in_ref (plug_in);
|
||||
plug_in_proc_frame_ref (proc_frame);
|
||||
|
||||
plug_in_main_loop (plug_in);
|
||||
|
||||
return_vals = plug_in_get_return_vals (plug_in,
|
||||
plug_in->temp_proc_frames->data);
|
||||
return_vals = plug_in_get_return_vals (plug_in, proc_frame);
|
||||
|
||||
plug_in_proc_frame_pop (plug_in);
|
||||
/* main_loop is quit and proc_frame is popped in
|
||||
* plug_in_handle_temp_proc_return()
|
||||
*/
|
||||
|
||||
plug_in_proc_frame_unref (proc_frame, plug_in);
|
||||
plug_in_unref (plug_in);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,8 @@ plug_in_proc_frame_new (GimpContext *context,
|
|||
|
||||
proc_frame = g_new0 (PlugInProcFrame, 1);
|
||||
|
||||
proc_frame->ref_count = 1;
|
||||
|
||||
plug_in_proc_frame_init (proc_frame, context, progress, proc_rec);
|
||||
|
||||
return proc_frame;
|
||||
|
@ -115,3 +117,26 @@ plug_in_proc_frame_free (PlugInProcFrame *proc_frame,
|
|||
|
||||
g_free (proc_frame);
|
||||
}
|
||||
|
||||
PlugInProcFrame *
|
||||
plug_in_proc_frame_ref (PlugInProcFrame *proc_frame)
|
||||
{
|
||||
g_return_val_if_fail (proc_frame != NULL, NULL);
|
||||
|
||||
proc_frame->ref_count++;
|
||||
|
||||
return proc_frame;
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_proc_frame_unref (PlugInProcFrame *proc_frame,
|
||||
PlugIn *plug_in)
|
||||
{
|
||||
g_return_if_fail (proc_frame != NULL);
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
|
||||
proc_frame->ref_count--;
|
||||
|
||||
if (proc_frame->ref_count < 1)
|
||||
plug_in_proc_frame_free (proc_frame, plug_in);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
struct _PlugInProcFrame
|
||||
{
|
||||
gint ref_count;
|
||||
|
||||
GimpContext *main_context;
|
||||
GList *context_stack;
|
||||
|
||||
|
@ -52,5 +54,9 @@ void plug_in_proc_frame_dispose (PlugInProcFrame *proc_frame,
|
|||
void plug_in_proc_frame_free (PlugInProcFrame *proc_frame,
|
||||
PlugIn *plug_in);
|
||||
|
||||
PlugInProcFrame * plug_in_proc_frame_ref (PlugInProcFrame *proc_frame);
|
||||
void plug_in_proc_frame_unref (PlugInProcFrame *proc_frame,
|
||||
PlugIn *plug_in);
|
||||
|
||||
|
||||
#endif /* __PLUG_IN_PROC_FRAME_H__ */
|
||||
|
|
|
@ -550,6 +550,7 @@ plug_in_handle_temp_proc_return (PlugIn *plug_in,
|
|||
plug_in_handle_proc_return_priv (plug_in, proc_return, TRUE);
|
||||
|
||||
plug_in_main_loop_quit (plug_in);
|
||||
plug_in_proc_frame_pop (plug_in);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -46,6 +46,8 @@ plug_in_proc_frame_new (GimpContext *context,
|
|||
|
||||
proc_frame = g_new0 (PlugInProcFrame, 1);
|
||||
|
||||
proc_frame->ref_count = 1;
|
||||
|
||||
plug_in_proc_frame_init (proc_frame, context, progress, proc_rec);
|
||||
|
||||
return proc_frame;
|
||||
|
@ -115,3 +117,26 @@ plug_in_proc_frame_free (PlugInProcFrame *proc_frame,
|
|||
|
||||
g_free (proc_frame);
|
||||
}
|
||||
|
||||
PlugInProcFrame *
|
||||
plug_in_proc_frame_ref (PlugInProcFrame *proc_frame)
|
||||
{
|
||||
g_return_val_if_fail (proc_frame != NULL, NULL);
|
||||
|
||||
proc_frame->ref_count++;
|
||||
|
||||
return proc_frame;
|
||||
}
|
||||
|
||||
void
|
||||
plug_in_proc_frame_unref (PlugInProcFrame *proc_frame,
|
||||
PlugIn *plug_in)
|
||||
{
|
||||
g_return_if_fail (proc_frame != NULL);
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
|
||||
proc_frame->ref_count--;
|
||||
|
||||
if (proc_frame->ref_count < 1)
|
||||
plug_in_proc_frame_free (proc_frame, plug_in);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
struct _PlugInProcFrame
|
||||
{
|
||||
gint ref_count;
|
||||
|
||||
GimpContext *main_context;
|
||||
GList *context_stack;
|
||||
|
||||
|
@ -52,5 +54,9 @@ void plug_in_proc_frame_dispose (PlugInProcFrame *proc_frame,
|
|||
void plug_in_proc_frame_free (PlugInProcFrame *proc_frame,
|
||||
PlugIn *plug_in);
|
||||
|
||||
PlugInProcFrame * plug_in_proc_frame_ref (PlugInProcFrame *proc_frame);
|
||||
void plug_in_proc_frame_unref (PlugInProcFrame *proc_frame,
|
||||
PlugIn *plug_in);
|
||||
|
||||
|
||||
#endif /* __PLUG_IN_PROC_FRAME_H__ */
|
||||
|
|
|
@ -250,9 +250,11 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
|
||||
if (plug_in)
|
||||
{
|
||||
GPProcRun proc_run;
|
||||
PlugInProcFrame *proc_frame;
|
||||
GPProcRun proc_run;
|
||||
|
||||
plug_in_proc_frame_push (plug_in, context, progress, proc_rec);
|
||||
proc_frame = plug_in_proc_frame_push (plug_in, context, progress,
|
||||
proc_rec);
|
||||
|
||||
proc_run.name = proc_rec->name;
|
||||
proc_run.nparams = argc;
|
||||
|
@ -271,14 +273,17 @@ plug_in_temp_run (ProcRecord *proc_rec,
|
|||
plug_in_params_destroy (proc_run.params, proc_run.nparams, FALSE);
|
||||
|
||||
plug_in_ref (plug_in);
|
||||
plug_in_proc_frame_ref (proc_frame);
|
||||
|
||||
plug_in_main_loop (plug_in);
|
||||
|
||||
return_vals = plug_in_get_return_vals (plug_in,
|
||||
plug_in->temp_proc_frames->data);
|
||||
return_vals = plug_in_get_return_vals (plug_in, proc_frame);
|
||||
|
||||
plug_in_proc_frame_pop (plug_in);
|
||||
/* main_loop is quit and proc_frame is popped in
|
||||
* plug_in_handle_temp_proc_return()
|
||||
*/
|
||||
|
||||
plug_in_proc_frame_unref (proc_frame, plug_in);
|
||||
plug_in_unref (plug_in);
|
||||
}
|
||||
|
||||
|
|
|
@ -878,7 +878,7 @@ plug_in_get_proc_frame (PlugIn *plug_in)
|
|||
return &plug_in->main_proc_frame;
|
||||
}
|
||||
|
||||
void
|
||||
PlugInProcFrame *
|
||||
plug_in_proc_frame_push (PlugIn *plug_in,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
|
@ -886,15 +886,17 @@ plug_in_proc_frame_push (PlugIn *plug_in,
|
|||
{
|
||||
PlugInProcFrame *proc_frame;
|
||||
|
||||
g_return_if_fail (plug_in != NULL);
|
||||
g_return_if_fail (GIMP_IS_CONTEXT (context));
|
||||
g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
|
||||
g_return_if_fail (proc_rec != NULL);
|
||||
g_return_val_if_fail (plug_in != NULL, NULL);
|
||||
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
|
||||
g_return_val_if_fail (proc_rec != NULL, NULL);
|
||||
|
||||
proc_frame = plug_in_proc_frame_new (context, progress, proc_rec);
|
||||
|
||||
plug_in->temp_proc_frames = g_list_prepend (plug_in->temp_proc_frames,
|
||||
proc_frame);
|
||||
|
||||
return proc_frame;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -907,7 +909,7 @@ plug_in_proc_frame_pop (PlugIn *plug_in)
|
|||
|
||||
proc_frame = (PlugInProcFrame *) plug_in->temp_proc_frames->data;
|
||||
|
||||
plug_in_proc_frame_free (proc_frame, plug_in);
|
||||
plug_in_proc_frame_unref (proc_frame, plug_in);
|
||||
|
||||
plug_in->temp_proc_frames = g_list_remove (plug_in->temp_proc_frames,
|
||||
proc_frame);
|
||||
|
|
|
@ -97,7 +97,7 @@ void plug_in_pop (Gimp *gimp);
|
|||
|
||||
PlugInProcFrame * plug_in_get_proc_frame (PlugIn *plug_in);
|
||||
|
||||
void plug_in_proc_frame_push (PlugIn *plug_in,
|
||||
PlugInProcFrame * plug_in_proc_frame_push (PlugIn *plug_in,
|
||||
GimpContext *context,
|
||||
GimpProgress *progress,
|
||||
ProcRecord *proc_rec);
|
||||
|
|
Loading…
Reference in New Issue