+2007-02-03 Carlos Garcia Campos <carlosgc@gnome.org>
+
+ * backend/ps/ps-document.c: (ps_interpreter_finished),
+ (ps_interpreter_start), (ps_interpreter_failed):
+
+ Handle ghostscript interpreter crashes.
+
2007-02-02 Carlos Garcia Campos <carlosgc@gnome.org>
* shell/ev-window.c: (ev_window_open_uri),
return TRUE;
}
+static void
+ps_interpreter_finished (GPid pid,
+ gint status,
+ PSDocument *gs)
+{
+ g_spawn_close_pid (gs->interpreter_pid);
+ gs->interpreter_pid = -1;
+ ps_interpreter_failed (gs, NULL);
+}
+
#define NUM_ARGS 100
#define NUM_GS_ARGS (NUM_ARGS - 20)
#define NUM_ALPHA_ARGS 10
envp = g_strsplit (gv_env, ";", 2);
g_free (gv_env);
- if (g_spawn_async_with_pipes (dir, argv, NULL, 0,
+ if (g_spawn_async_with_pipes (dir, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
(GSpawnChildSetupFunc)setup_interpreter_env, envp,
&(gs->interpreter_pid),
&pin, &pout, &perr,
&error)) {
GIOFlags flags;
+ g_child_watch_add (gs->interpreter_pid,
+ (GChildWatchFunc)ps_interpreter_finished,
+ gs);
+
gs->interpreter_input = g_io_channel_unix_new (pin);
g_io_channel_set_encoding (gs->interpreter_input, NULL, NULL);
flags = g_io_channel_get_flags (gs->interpreter_input);
static void
ps_interpreter_failed (PSDocument *gs, const char *msg)
{
- if (msg)
- g_warning (msg);
+ g_warning (msg ? msg : _("Interpreter failed."));
push_pixbuf (gs);
ps_interpreter_stop (gs);