mirror of https://github.com/GNOME/gimp.git
Another try to get the signal/dead child recovery stuff right.
2000-05-10 Michael Natterer <mitch@gimp.org> Another try to get the signal/dead child recovery stuff right. Could the brave signal crew (TM) (Austin, Garry, Raphael, Tim) please do bad tests to the new code? I removed all strange constants (SA_NODEFER etc.) and used only glib and POSIX stuff. * app/main.c * libgimp/gimp.c: - Call gimp_signal_private() with no flags to enforce a proper sigaction() behaviour (block signals while handler is active). - Removed the reentrancy guards from the handlers. - Renamed the handlers. - Ignore SIGPIPE in the app and in plugins. - Re-introduced the SIGCHLD handler because it should work now. Also added a SIGCHLD handler to libgimp/gimp.c. * app/errors.c * libgimp/gimp.c: in the signal handler, unblock all signals with sigprocmask() before calling g_on_error_query() because gdb otherwise inherits the blocked signals and does nothing. Wrapped the statements with "if (TRUE) { }" blocks so it's easy to make the stack trace a command line option. * app/plug_in.c * libgimp/gimp.c: listen for G_IO_ERR and G_IO_HUP on the read channels. In the app, pop up an error message and clean up the plugin. In plugins, clean up and exit. * libgimp/gimpwire.c: removed the "plug-in chrashed?" message and print the program's name with all error messages. * plug-ins/helpbrowser/helpbrowser.c: typo.
This commit is contained in:
parent
9879f8d325
commit
86e4b1ef65
35
ChangeLog
35
ChangeLog
|
@ -1,3 +1,38 @@
|
|||
2000-05-10 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Another try to get the signal/dead child recovery stuff right.
|
||||
|
||||
Could the brave signal crew (TM) (Austin, Garry, Raphael, Tim)
|
||||
please do bad tests to the new code? I removed all strange
|
||||
constants (SA_NODEFER etc.) and used only glib and POSIX stuff.
|
||||
|
||||
* app/main.c
|
||||
* libgimp/gimp.c:
|
||||
- Call gimp_signal_private() with no flags to enforce a proper
|
||||
sigaction() behaviour (block signals while handler is active).
|
||||
- Removed the reentrancy guards from the handlers.
|
||||
- Renamed the handlers.
|
||||
- Ignore SIGPIPE in the app and in plugins.
|
||||
- Re-introduced the SIGCHLD handler because it should work
|
||||
now. Also added a SIGCHLD handler to libgimp/gimp.c.
|
||||
|
||||
* app/errors.c
|
||||
* libgimp/gimp.c: in the signal handler, unblock all signals
|
||||
with sigprocmask() before calling g_on_error_query() because
|
||||
gdb otherwise inherits the blocked signals and does nothing.
|
||||
Wrapped the statements with "if (TRUE) { }" blocks so it's
|
||||
easy to make the stack trace a command line option.
|
||||
|
||||
* app/plug_in.c
|
||||
* libgimp/gimp.c: listen for G_IO_ERR and G_IO_HUP on the read
|
||||
channels. In the app, pop up an error message and clean up the
|
||||
plugin. In plugins, clean up and exit.
|
||||
|
||||
* libgimp/gimpwire.c: removed the "plug-in chrashed?" message
|
||||
and print the program's name with all error messages.
|
||||
|
||||
* plug-ins/helpbrowser/helpbrowser.c: typo.
|
||||
|
||||
2000-05-10 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* README.win32: Clarifications.
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
13
app/errors.c
13
app/errors.c
|
@ -78,7 +78,14 @@ gimp_fatal_error (gchar *fmt, ...)
|
|||
g_print ("%s: fatal error: %s\n", prog_name, g_strdup_vprintf (fmt, args));
|
||||
va_end (args);
|
||||
|
||||
if (TRUE)
|
||||
{
|
||||
sigset_t sigset;
|
||||
|
||||
sigemptyset (&sigset);
|
||||
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
||||
g_on_error_query (prog_name);
|
||||
}
|
||||
#else
|
||||
/* g_on_error_query doesn't do anything reasonable on Win32. */
|
||||
va_list args;
|
||||
|
@ -106,7 +113,13 @@ gimp_terminate (gchar *fmt, ...)
|
|||
va_end (args);
|
||||
|
||||
if (use_debug_handler)
|
||||
{
|
||||
sigset_t sigset;
|
||||
|
||||
sigemptyset (&sigset);
|
||||
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
||||
g_on_error_query (prog_name);
|
||||
}
|
||||
#else
|
||||
/* g_on_error_query doesn't do anything reasonable on Win32. */
|
||||
va_list args;
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
105
app/main.c
105
app/main.c
|
@ -54,11 +54,12 @@
|
|||
#ifdef G_OS_WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
static void on_signal (gint);
|
||||
static void gimp_sigfatal_handler (gint sig_num);
|
||||
static void gimp_sigchld_handler (gint sig_num);
|
||||
#endif
|
||||
|
||||
static void init (void);
|
||||
static void on_error (const gchar *domain,
|
||||
static void gimp_error_handler (const gchar *domain,
|
||||
GLogLevelFlags flags,
|
||||
const gchar *msg,
|
||||
gpointer user_data);
|
||||
|
@ -327,37 +328,36 @@ main (int argc,
|
|||
|
||||
/* No use catching these on Win32, the user won't get any
|
||||
* stack trace from glib anyhow. It's better to let Windows inform
|
||||
* about the program error, and offer debugging (if the use
|
||||
* about the program error, and offer debugging (if the user
|
||||
* has installed MSVC or some other compiler that knows how to
|
||||
* install itself as a handler for program errors).
|
||||
*/
|
||||
|
||||
/* Handle some signals */
|
||||
/* Handle fatal signals */
|
||||
|
||||
gimp_signal_private (SIGHUP, on_signal, SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGINT, on_signal, SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGQUIT, on_signal, SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGABRT, on_signal, SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGBUS, on_signal, SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGSEGV, on_signal, SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGPIPE, on_signal, SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGTERM, on_signal, SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGFPE, on_signal, SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGHUP, gimp_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGINT, gimp_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGQUIT, gimp_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGABRT, gimp_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGBUS, gimp_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGSEGV, gimp_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGTERM, gimp_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGFPE, gimp_sigfatal_handler, 0);
|
||||
|
||||
#ifndef __EMX__ /* OS/2 may not support SA_NOCLDSTOP -GRO */
|
||||
/* Ignore SIGPIPE because plug_in.c handles broken pipes */
|
||||
|
||||
/* Disable child exit notification. This doesn't just block */
|
||||
/* receipt of SIGCHLD, it in fact completely disables the */
|
||||
/* generation of the signal by the OS. This behavior is */
|
||||
/* mandated by POSIX.1. */
|
||||
gimp_signal_private (SIGPIPE, SIG_IGN, 0);
|
||||
|
||||
gimp_signal_private (SIGCHLD, NULL, SA_NOCLDSTOP);
|
||||
/* Collect dead children */
|
||||
|
||||
#endif
|
||||
#endif
|
||||
gimp_signal_private (SIGCHLD, gimp_sigchld_handler, SA_RESTART);
|
||||
|
||||
g_log_set_handler (NULL, G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL,
|
||||
on_error, NULL);
|
||||
#endif /* G_OS_WIN32 */
|
||||
|
||||
g_log_set_handler (NULL,
|
||||
G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL,
|
||||
gimp_error_handler,
|
||||
NULL);
|
||||
|
||||
/* Keep the command line arguments--for use in gimp_init */
|
||||
gimp_argc = argc - 1;
|
||||
|
@ -403,7 +403,7 @@ init (void)
|
|||
|
||||
|
||||
static void
|
||||
on_error (const gchar *domain,
|
||||
gimp_error_handler (const gchar *domain,
|
||||
GLogLevelFlags flags,
|
||||
const gchar *msg,
|
||||
gpointer user_data)
|
||||
|
@ -416,55 +416,40 @@ on_error (const gchar *domain,
|
|||
/* gimp core signal handler for fatal signals */
|
||||
|
||||
static void
|
||||
on_signal (gint sig_num)
|
||||
gimp_sigfatal_handler (gint sig_num)
|
||||
{
|
||||
static gboolean caught_fatal_sig = FALSE;
|
||||
|
||||
if (caught_fatal_sig)
|
||||
kill (getpid (), sig_num);
|
||||
caught_fatal_sig = TRUE;
|
||||
|
||||
switch (sig_num)
|
||||
{
|
||||
|
||||
case SIGHUP:
|
||||
gimp_terminate ("sighup caught");
|
||||
break;
|
||||
|
||||
case SIGINT:
|
||||
gimp_terminate ("sigint caught");
|
||||
break;
|
||||
|
||||
case SIGQUIT:
|
||||
gimp_terminate ("sigquit caught");
|
||||
break;
|
||||
|
||||
case SIGABRT:
|
||||
gimp_terminate ("sigabrt caught");
|
||||
case SIGTERM:
|
||||
gimp_terminate (g_strsignal (sig_num));
|
||||
break;
|
||||
|
||||
case SIGBUS:
|
||||
gimp_fatal_error ("sigbus caught");
|
||||
break;
|
||||
|
||||
case SIGSEGV:
|
||||
gimp_fatal_error ("sigsegv caught");
|
||||
break;
|
||||
|
||||
case SIGPIPE:
|
||||
gimp_terminate ("sigpipe caught");
|
||||
break;
|
||||
|
||||
case SIGTERM:
|
||||
gimp_terminate ("sigterm caught");
|
||||
break;
|
||||
|
||||
case SIGFPE:
|
||||
gimp_fatal_error ("sigfpe caught");
|
||||
break;
|
||||
|
||||
default:
|
||||
gimp_fatal_error ("unknown signal");
|
||||
gimp_fatal_error (g_strsignal (sig_num));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* gimp core signal handler for death-of-child signals */
|
||||
|
||||
static void
|
||||
gimp_sigchld_handler (gint sig_num)
|
||||
{
|
||||
gint pid;
|
||||
gint status;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
pid = waitpid (WAIT_ANY, &status, WNOHANG);
|
||||
|
||||
if (pid <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,11 @@ plug_in_init (void)
|
|||
}
|
||||
|
||||
/* insert the proc defs */
|
||||
tmp = gimprc_proc_defs;
|
||||
while (tmp)
|
||||
for (tmp = gimprc_proc_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
proc_def = g_new (PlugInProcDef, 1);
|
||||
*proc_def = *((PlugInProcDef*) tmp->data);
|
||||
plug_in_proc_def_insert (proc_def, NULL);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
tmp = plug_in_defs;
|
||||
|
@ -408,11 +406,9 @@ plug_in_init (void)
|
|||
g_print ("\n");
|
||||
|
||||
/* free up stuff */
|
||||
tmp = plug_in_defs;
|
||||
while (tmp)
|
||||
for (tmp = plug_in_defs; tmp; tmp = g_slist_next (tmp))
|
||||
{
|
||||
plug_in_def = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
plug_in_def_free (plug_in_def, FALSE);
|
||||
}
|
||||
|
@ -1033,8 +1029,9 @@ plug_in_open (PlugIn *plug_in)
|
|||
|
||||
if (!plug_in->synchronous)
|
||||
{
|
||||
plug_in->input_id = g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI,
|
||||
plug_in->input_id =
|
||||
g_io_add_watch (plug_in->my_read,
|
||||
G_IO_IN | G_IO_PRI | G_IO_ERR | G_IO_HUP,
|
||||
plug_in_recv_message,
|
||||
plug_in);
|
||||
|
||||
|
@ -1176,12 +1173,10 @@ plug_in_close (PlugIn *plug_in,
|
|||
GSList *list;
|
||||
PlugInProcDef *proc_def;
|
||||
|
||||
list = plug_in->temp_proc_defs;
|
||||
while (list)
|
||||
for (list = plug_in->temp_proc_defs; list; list = g_slist_next (list))
|
||||
{
|
||||
proc_def = (PlugInProcDef *) list->data;
|
||||
plug_in_proc_def_remove (proc_def);
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
g_slist_free (plug_in->temp_proc_defs);
|
||||
|
@ -1405,25 +1400,51 @@ plug_in_recv_message (GIOChannel *channel,
|
|||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
WireMessage msg;
|
||||
gboolean got_message = FALSE;
|
||||
|
||||
if ((PlugIn *) data != current_plug_in)
|
||||
plug_in_push ((PlugIn *) data);
|
||||
|
||||
if (current_readchannel == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (cond & (G_IO_IN | G_IO_PRI))
|
||||
{
|
||||
WireMessage msg;
|
||||
|
||||
memset (&msg, 0, sizeof (WireMessage));
|
||||
|
||||
if (!wire_read_msg (current_readchannel, &msg))
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
plug_in_handle_message (&msg);
|
||||
wire_destroy (&msg);
|
||||
got_message = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cond & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
if (current_plug_in->open)
|
||||
{
|
||||
plug_in_close (current_plug_in, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!got_message)
|
||||
g_message (_("Plug-In crashed: %s\n(%s)"),
|
||||
g_basename (current_plug_in->args[0]),
|
||||
current_plug_in->args[0]);
|
||||
|
||||
if (!current_plug_in->open)
|
||||
plug_in_destroy (current_plug_in);
|
||||
else
|
||||
plug_in_pop ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
121
libgimp/gimp.c
121
libgimp/gimp.c
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <locale.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -31,6 +32,9 @@
|
|||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -77,10 +81,17 @@ void gimp_read_expect_msg (WireMessage *msg, gint type);
|
|||
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
static void gimp_plugin_signalhandler (gint signum);
|
||||
static void gimp_plugin_sigfatal_handler (gint sig_num);
|
||||
static void gimp_plugin_sigchld_handler (gint sig_num);
|
||||
#endif
|
||||
static int gimp_write (GIOChannel *channel , guint8 *buf, gulong count);
|
||||
static int gimp_flush (GIOChannel *channel);
|
||||
static gboolean gimp_plugin_io_error_handler (GIOChannel *channel,
|
||||
GIOCondition cond,
|
||||
gpointer data);
|
||||
|
||||
static gint gimp_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
gulong count);
|
||||
static gint gimp_flush (GIOChannel *channel);
|
||||
static void gimp_loop (void);
|
||||
static void gimp_config (GPConfig *config);
|
||||
static void gimp_proc_run (GPProcRun *proc_run);
|
||||
|
@ -192,28 +203,27 @@ gimp_main (int argc,
|
|||
|
||||
progname = argv[0];
|
||||
|
||||
g_set_prgname (g_basename (progname));
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
/* No use catching these on Win32, the user won't get any meaningful
|
||||
* stack trace from glib anyhow. It's better to let Windows inform
|
||||
* about the program error, and offer debugging if the plug-in
|
||||
* has been built with MSVC, and the user has MSVC installed.
|
||||
*/
|
||||
gimp_signal_private (SIGHUP, gimp_plugin_signalhandler,
|
||||
SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGINT, gimp_plugin_signalhandler,
|
||||
SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGQUIT, gimp_plugin_signalhandler,
|
||||
SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGBUS, gimp_plugin_signalhandler,
|
||||
SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGSEGV, gimp_plugin_signalhandler,
|
||||
SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGPIPE, gimp_plugin_signalhandler,
|
||||
SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGTERM, gimp_plugin_signalhandler,
|
||||
SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGFPE, gimp_plugin_signalhandler,
|
||||
SA_RESETHAND | SA_NODEFER);
|
||||
gimp_signal_private (SIGHUP, gimp_plugin_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGINT, gimp_plugin_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGQUIT, gimp_plugin_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGBUS, gimp_plugin_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGSEGV, gimp_plugin_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGTERM, gimp_plugin_sigfatal_handler, 0);
|
||||
gimp_signal_private (SIGFPE, gimp_plugin_sigfatal_handler, 0);
|
||||
|
||||
/* Ignore SIGPIPE from crashing Gimp */
|
||||
gimp_signal_private (SIGPIPE, SIG_IGN, 0);
|
||||
|
||||
/* Restart syscalls interrupted by SIGCHLD */
|
||||
gimp_signal_private (SIGCHLD, gimp_plugin_sigchld_handler, SA_RESTART);
|
||||
#endif
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
|
@ -255,6 +265,11 @@ gimp_main (int argc,
|
|||
|
||||
temp_proc_ht = g_hash_table_new (&g_str_hash, &g_str_equal);
|
||||
|
||||
g_io_add_watch (_readchannel,
|
||||
G_IO_ERR | G_IO_HUP,
|
||||
gimp_plugin_io_error_handler,
|
||||
NULL);
|
||||
|
||||
gimp_loop ();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1153,39 +1168,63 @@ gimp_request_wakeups (void)
|
|||
|
||||
#ifndef G_OS_WIN32
|
||||
static void
|
||||
gimp_plugin_signalhandler (gint signum)
|
||||
gimp_plugin_sigfatal_handler (gint sig_num)
|
||||
{
|
||||
static gboolean caught_fatal_sig = FALSE;
|
||||
|
||||
if (caught_fatal_sig)
|
||||
kill (getpid (), signum);
|
||||
|
||||
caught_fatal_sig = TRUE;
|
||||
|
||||
fprintf (stderr, "\n%s: %s caught\n", progname, g_strsignal (signum));
|
||||
|
||||
switch (signum)
|
||||
switch (sig_num)
|
||||
{
|
||||
#ifdef SIGBUS
|
||||
case SIGBUS:
|
||||
#endif
|
||||
#ifdef SIGSEGV
|
||||
case SIGSEGV:
|
||||
#endif
|
||||
#ifdef SIGFPE
|
||||
case SIGFPE:
|
||||
#endif
|
||||
case 123456: /* Must have some case value... */
|
||||
g_on_error_query (progname);
|
||||
case SIGHUP:
|
||||
case SIGINT:
|
||||
case SIGQUIT:
|
||||
case SIGABRT:
|
||||
case SIGTERM:
|
||||
g_print ("%s terminated: %s\n", progname, g_strsignal (sig_num));
|
||||
break;
|
||||
|
||||
case SIGBUS:
|
||||
case SIGSEGV:
|
||||
case SIGFPE:
|
||||
case SIGPIPE:
|
||||
default:
|
||||
g_print ("%s: fatal error: %s\n", progname, g_strsignal (sig_num));
|
||||
if (TRUE)
|
||||
{
|
||||
sigset_t sigset;
|
||||
|
||||
sigemptyset (&sigset);
|
||||
sigprocmask (SIG_SETMASK, &sigset, NULL);
|
||||
g_on_error_query (progname);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_plugin_sigchld_handler (gint sig_num)
|
||||
{
|
||||
gint pid;
|
||||
gint status;
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
pid = waitpid (WAIT_ANY, &status, WNOHANG);
|
||||
|
||||
if (pid <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
gimp_plugin_io_error_handler (GIOChannel *channel,
|
||||
GIOCondition cond,
|
||||
gpointer data)
|
||||
{
|
||||
g_print ("%s: fatal error: GIMP crashed\n", progname);
|
||||
gimp_quit ();
|
||||
}
|
||||
|
||||
static int
|
||||
gimp_write (GIOChannel *channel,
|
||||
guint8 *buf,
|
||||
|
|
|
@ -113,7 +113,7 @@ wire_read (GIOChannel *channel,
|
|||
{
|
||||
if (!(* wire_read_func) (channel, buf, count))
|
||||
{
|
||||
g_warning ("wire_read: error");
|
||||
g_warning ("%s: wire_read: error", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -132,14 +132,14 @@ wire_read (GIOChannel *channel,
|
|||
|
||||
if (error != G_IO_ERROR_NONE)
|
||||
{
|
||||
g_warning ("wire_read: error");
|
||||
g_warning ("%s: wire_read: error", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (bytes == 0)
|
||||
{
|
||||
g_warning ("wire_read: unexpected EOF (plug-in crashed?)");
|
||||
g_warning ("%s: wire_read: unexpected EOF", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ wire_write (GIOChannel *channel,
|
|||
{
|
||||
if (!(* wire_write_func) (channel, buf, count))
|
||||
{
|
||||
g_warning ("wire_write: error");
|
||||
g_warning ("%s: wire_write: error", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ wire_write (GIOChannel *channel,
|
|||
|
||||
if (error != G_IO_ERROR_NONE)
|
||||
{
|
||||
g_warning ("wire_write: error");
|
||||
g_warning ("%s: wire_write: error", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ wire_read (GIOChannel *channel,
|
|||
{
|
||||
if (!(* wire_read_func) (channel, buf, count))
|
||||
{
|
||||
g_warning ("wire_read: error");
|
||||
g_warning ("%s: wire_read: error", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -132,14 +132,14 @@ wire_read (GIOChannel *channel,
|
|||
|
||||
if (error != G_IO_ERROR_NONE)
|
||||
{
|
||||
g_warning ("wire_read: error");
|
||||
g_warning ("%s: wire_read: error", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (bytes == 0)
|
||||
{
|
||||
g_warning ("wire_read: unexpected EOF (plug-in crashed?)");
|
||||
g_warning ("%s: wire_read: unexpected EOF", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ wire_write (GIOChannel *channel,
|
|||
{
|
||||
if (!(* wire_write_func) (channel, buf, count))
|
||||
{
|
||||
g_warning ("wire_write: error");
|
||||
g_warning ("%s: wire_write: error", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ wire_write (GIOChannel *channel,
|
|||
|
||||
if (error != G_IO_ERROR_NONE)
|
||||
{
|
||||
g_warning ("wire_write: error");
|
||||
g_warning ("%s: wire_write: error", g_get_prgname ());
|
||||
wire_error_val = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -716,7 +716,7 @@ open_browser_dialog (gchar *locale,
|
|||
gint success;
|
||||
guint i;
|
||||
|
||||
gimp_ui_init ("webbrowser", TRUE);
|
||||
gimp_ui_init ("helpbrowser", TRUE);
|
||||
|
||||
root_dir = g_strconcat (gimp_data_directory(), G_DIR_SEPARATOR_S,
|
||||
GIMP_HELP_PREFIX, NULL);
|
||||
|
|
Loading…
Reference in New Issue