+2006-07-17 Wim Taymans <wim@fluendo.com>
+
+ * docs/gst/gstreamer-sections.txt:
+ * gst/gst.c: (gst_segtrap_is_enabled), (gst_segtrap_set_enabled):
+ * gst/gst.h:
+ * gst/gstplugin.c: (_gst_plugin_fault_handler_restore):
+ Add two functions to check and change the SIGSEGV behaviour
+ when loading plugins.
+ Don't mess with the SIGSEGV handler when we were told not to.
+ Fixes #347794.
+ API: gst_segtrap_is_enabled
+ API: gst_segtrap_set_enabled
+
2006-07-14 Wim Taymans <wim@fluendo.com>
* libs/gst/base/gstbasesrc.c: (gst_base_src_update_length):
/* set to TRUE when segfaults need to be left as is */
gboolean _gst_disable_segtrap = FALSE;
-
static void load_plugin_func (gpointer data, gpointer user_data);
static gboolean init_pre (void);
static gboolean init_post (void);
return g_strdup_printf ("GStreamer %d.%d.%d (prerelease)", major, minor,
micro);
}
+
+/**
+ * gst_segtrap_is_enabled:
+ *
+ * Some functions in the GStreamer core might install a custom SIGSEGV handler to
+ * better catch and report errors to the application. Currently this feature is
+ * enabled by default when loading plugins.
+ *
+ * Applications might want to disable this behaviour with the
+ * gst_segtrap_set_enabled() function. This is typically done if the application
+ * wants to install its own handler without GStreamer interfering.
+ *
+ * Returns: %TRUE if GStreamer is allowed to install a custom SIGSEGV handler.
+ *
+ * Since: 0.10.10
+ */
+gboolean
+gst_segtrap_is_enabled (void)
+{
+ /* yeps, it's enabled when it's not disabled */
+ return !_gst_disable_segtrap;
+}
+
+/**
+ * gst_segtrap_set_enabled:
+ * @enabled: whether a custom SIGSEGV handler should be installed.
+ *
+ * Applications might want to disable/enable the SIGSEGV handling of
+ * the GStreamer core. See gst_segtrap_is_enabled() for more information.
+ *
+ * Since: 0.10.10
+ */
+void
+gst_segtrap_set_enabled (gboolean enabled)
+{
+ _gst_disable_segtrap = !enabled;
+}
guint *micro, guint *nano);
gchar * gst_version_string (void);
+gboolean gst_segtrap_is_enabled (void);
+void gst_segtrap_set_enabled (gboolean enabled);
+
G_END_DECLS
#endif /* __GST_H__ */
{
struct sigaction action;
+ /* if asked to leave segfaults alone, just return */
+ if (_gst_disable_segtrap)
+ return;
+
memset (&action, 0, sizeof (action));
action.sa_handler = SIG_DFL;