gst/gstplugin.c: Restore the previous signal handler for SIGSEGV instead of setting...
authorDavid Schleef <ds@schleef.org>
Tue, 2 Jan 2007 06:14:06 +0000 (06:14 +0000)
committerDavid Schleef <ds@schleef.org>
Tue, 2 Jan 2007 06:14:06 +0000 (06:14 +0000)
Original commit message from CVS:
* gst/gstplugin.c:
Restore the previous signal handler for SIGSEGV instead of
setting to default, since we may have stolen it away from
someone.  (i.e., Mono)

ChangeLog
gst/gstplugin.c

index cc9fb85..b1ffc60 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-01-01  David Schleef  <ds@schleef.org>
+
+       * gst/gstplugin.c:
+         Restore the previous signal handler for SIGSEGV instead of
+         setting to default, since we may have stolen it away from
+         someone.  (i.e., Mono)
+
 2006-12-26  Tim-Philipp Müller  <tim at centricular dot net>
 
        * docs/random/draft-missing-plugins.txt:
index 64e4ee9..f0c454e 100644 (file)
@@ -270,6 +270,8 @@ gst_plugin_register_func (GstPlugin * plugin, GModule * module,
 }
 
 #ifndef HAVE_WIN32
+static struct sigaction oldaction;
+
 /*
  * _gst_plugin_fault_handler_restore:
  * segfault handler restorer
@@ -277,16 +279,12 @@ gst_plugin_register_func (GstPlugin * plugin, GModule * module,
 static void
 _gst_plugin_fault_handler_restore (void)
 {
-  struct sigaction action;
-
-  /* if asked to leave segfaults alone, just return */
-  if (_gst_disable_segtrap)
+  if (!_gst_plugin_fault_handler_is_setup)
     return;
 
-  memset (&action, 0, sizeof (action));
-  action.sa_handler = SIG_DFL;
+  _gst_plugin_fault_handler_is_setup = FALSE;
 
-  sigaction (SIGSEGV, &action, NULL);
+  sigaction (SIGSEGV, &oldaction, NULL);
 }
 
 /*
@@ -331,10 +329,12 @@ _gst_plugin_fault_handler_setup (void)
   if (_gst_plugin_fault_handler_is_setup)
     return;
 
+  _gst_plugin_fault_handler_is_setup = TRUE;
+
   memset (&action, 0, sizeof (action));
   action.sa_handler = _gst_plugin_fault_handler_sighandler;
 
-  sigaction (SIGSEGV, &action, NULL);
+  sigaction (SIGSEGV, &action, &oldaction);
 }
 #else
 static void