From b7e44879526e658e9eb9aa1951c9e0a39634b8c9 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 2 Jan 2007 06:14:06 +0000 Subject: [PATCH] gst/gstplugin.c: Restore the previous signal handler for SIGSEGV instead of setting to default, since we may have sto... 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 | 7 +++++++ gst/gstplugin.c | 16 ++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc9fb85519..b1ffc60725 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-01-01 David Schleef + + * 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 * docs/random/draft-missing-plugins.txt: diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 64e4ee940f..f0c454e739 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -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