small segv-handler patch in libgnomeui



Howdy,

This patch makes libgnomeui_segv_setup() not touch the signals if
diable_crash_dialog is set -- previously, it was setting all the signals
to SIG_DFL, killing any handlers that may have been installed before
gnome is initialized.  This is currently affecting mono/gtk-sharp, since
it traps segv and the like and throws an exception (and lets you get a
nice C# backtrace).. it's possibly affecting other non-dinosaur
languages as well :)

-- 
Vladimir Vukicevic <vladimir pobox com>
? segv-setup.patch
? libgnomeui/ChangeLog-19990928.flc
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnomeui/ChangeLog,v
retrieving revision 1.228
diff -u -u -r1.228 ChangeLog
--- ChangeLog	27 Sep 2002 21:26:54 -0000	1.228
+++ ChangeLog	4 Oct 2002 19:39:03 -0000
@@ -1,3 +1,9 @@
+2002-10-04  Vladimir Vukicevic  <vladimir pobox com>
+
+	* libgnomeui/gnome-ui-init.c (libgnomeui_segv_setup): don't reset
+	signals to SIG_DFL if do_crash_dialog is false, leave them
+	as-is.
+
 2002-09-27  Anders Carlsson  <andersca gnu org>
 
 	* configure.in: Release 2.1.0
Index: libgnomeui/gnome-ui-init.c
===================================================================
RCS file: /cvs/gnome/libgnomeui/libgnomeui/gnome-ui-init.c,v
retrieving revision 1.186
diff -u -u -r1.186 gnome-ui-init.c
--- libgnomeui/gnome-ui-init.c	16 Aug 2002 12:48:47 -0000	1.186
+++ libgnomeui/gnome-ui-init.c	4 Oct 2002 19:39:03 -0000
@@ -587,20 +587,19 @@
         do_crash_dialog = g_value_get_boolean (&value);
         g_value_unset (&value);
 
-        memset(&sa, 0, sizeof(sa));
-
-        setptr = &sa;
         if(do_crash_dialog) {
+                memset(&sa, 0, sizeof(sa));
+                setptr = &sa;
+
                 sa.sa_handler = (gpointer)libgnomeui_segv_handle;
-        } else {
-                sa.sa_handler = SIG_DFL;
+
+                sigaction(SIGSEGV, setptr, NULL);
+                sigaction(SIGABRT, setptr, NULL);
+                sigaction(SIGTRAP, setptr, NULL);
+                sigaction(SIGFPE, setptr, NULL);
+                sigaction(SIGBUS, setptr, NULL);
         }
 
-        sigaction(SIGSEGV, setptr, NULL);
-        sigaction(SIGABRT, setptr, NULL);
-        sigaction(SIGTRAP, setptr, NULL);
-        sigaction(SIGFPE, setptr, NULL);
-        sigaction(SIGBUS, setptr, NULL);
 }
 
 static void libgnomeui_segv_handle(int signum)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]