# HG changeset patch # User Sean Egan # Date 1158008852 0 # Node ID 497f4e9a037552edc84daf9b199c9e69249ccfbf # Parent b4c04b1891d6cfc7760dbeca81e3e17f7ad06169 [gaim-migrate @ 17254] The Glib timeout was causing reentrency issues, so I reimplemented it with alarm() committer: Tailor Script diff -r b4c04b1891d6 -r 497f4e9a0375 gtk/gtkmain.c --- a/gtk/gtkmain.c Mon Sep 11 18:34:36 2006 +0000 +++ b/gtk/gtkmain.c Mon Sep 11 21:07:32 2006 +0000 @@ -89,7 +89,6 @@ #endif #ifdef HAVE_SIGNAL_H -static guint clean_pid_timeout = 0; /* * Lists of signals we wish to catch and those we wish to ignore. @@ -102,6 +101,7 @@ SIGTERM, SIGQUIT, SIGCHLD, + SIGALRM, -1 }; @@ -175,14 +175,12 @@ * during initialization. But it's not in 0.10.0, so we shouldn't * use it. */ -static gboolean -clean_pid(gpointer data) +static void +clean_pid() { int status; pid_t pid; - clean_pid_timeout = 0; - do { pid = waitpid(-1, &status, WNOHANG); } while (pid != 0 && pid != (pid_t)-1); @@ -194,10 +192,7 @@ } /* Restore signal catching */ - signal(SIGCHLD, sighandler); - - /* This timer should not be called again by glib */ - return FALSE; + signal(SIGALRM, sighandler); } char *segfault_message; @@ -215,9 +210,12 @@ abort(); break; case SIGCHLD: - if (clean_pid_timeout > 0) - gaim_timeout_remove(clean_pid_timeout); - clean_pid_timeout = gaim_timeout_add(1000, clean_pid, NULL); + /* Restore signal catching */ + signal(SIGCHLD, sighandler); + alarm(1); + break; + case SIGALRM: + clean_pid(); break; default: gaim_debug_warning("sighandler", "Caught signal %d\n", sig); @@ -802,8 +800,6 @@ gtk_main(); #ifdef HAVE_SIGNAL_H - if (clean_pid_timeout > 0) - gaim_timeout_remove(clean_pid_timeout); g_free(segfault_message); #endif