aboutsummaryrefslogtreecommitdiffstats
path: root/mail/main.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-01-23 07:16:33 +0800
committerDan Winship <danw@src.gnome.org>2001-01-23 07:16:33 +0800
commitff2d16601e0b4b71339b0820f4d2a5e0e92fdb92 (patch)
tree01655e9609b6c379a4f243dde2d55c036a230c1f /mail/main.c
parentc5cc88c6ca43bf5bd420b67b2212ab68f7203f47 (diff)
downloadgsoc2013-evolution-ff2d16601e0b4b71339b0820f4d2a5e0e92fdb92.tar
gsoc2013-evolution-ff2d16601e0b4b71339b0820f4d2a5e0e92fdb92.tar.gz
gsoc2013-evolution-ff2d16601e0b4b71339b0820f4d2a5e0e92fdb92.tar.bz2
gsoc2013-evolution-ff2d16601e0b4b71339b0820f4d2a5e0e92fdb92.tar.lz
gsoc2013-evolution-ff2d16601e0b4b71339b0820f4d2a5e0e92fdb92.tar.xz
gsoc2013-evolution-ff2d16601e0b4b71339b0820f4d2a5e0e92fdb92.tar.zst
gsoc2013-evolution-ff2d16601e0b4b71339b0820f4d2a5e0e92fdb92.zip
make mail_gui_thread non-static.
* mail-mt.[ch]: make mail_gui_thread non-static. * main.c (main): Set up signal handler for SEGV, BUS, FPE (segv_redirect): if a gnome-segv'ing signal is received in a thread other than mail_gui_thread, re-deliver it to that thread to work around a problem with the gnome segv handler. svn path=/trunk/; revision=7728
Diffstat (limited to 'mail/main.c')
-rw-r--r--mail/main.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/mail/main.c b/mail/main.c
index ce0b776b08..2b3c08e452 100644
--- a/mail/main.c
+++ b/mail/main.c
@@ -40,10 +40,27 @@ static int blowup(int status)
}
#endif
+/* The GNOME SEGV handler will lose if it's not run from the main Gtk
+ * thread. So if we crash in another thread, redirect the signal.
+ */
+static void (*gnome_segv_handler) (int);
+
+static void
+segv_redirect (int sig)
+{
+ if (pthread_self () == mail_gui_thread)
+ gnome_segv_handler (sig);
+ else {
+ pthread_kill (mail_gui_thread, sig);
+ pthread_exit (NULL);
+ }
+}
+
int
main (int argc, char *argv [])
{
CORBA_ORB orb;
+ struct sigaction sa, osa;
#if 0
/* used to make elfence work */
@@ -61,6 +78,15 @@ main (int argc, char *argv [])
gnome_init_with_popt_table ("evolution-mail-component", VERSION,
argc, argv, oaf_popt_options, 0, NULL);
+
+ sa.sa_flags = 0;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_handler = segv_redirect;
+ sigaction (SIGSEGV, &sa, &osa);
+ sigaction (SIGBUS, &sa, NULL);
+ sigaction (SIGFPE, &sa, NULL);
+ gnome_segv_handler = osa.sa_handler;
+
orb = oaf_init (argc, argv);
if (bonobo_init (orb, CORBA_OBJECT_NIL,
@@ -87,9 +113,6 @@ main (int argc, char *argv [])
evolution_composer_factory_init (composer_send_cb,
composer_postpone_cb);
- signal (SIGSEGV, SIG_DFL);
- signal (SIGBUS, SIG_DFL);
-
if (gdk_threads_mutex) {
g_mutex_free (gdk_threads_mutex);
gdk_threads_mutex = NULL;