From 16490dc0cf0799493ca99a061264d7cc270eb3f4 Mon Sep 17 00:00:00 2001 From: Sebastian Dröge Date: Thu, 1 Mar 2007 01:48:59 +0000 Subject: ext/hal/: Check if the device UDI is set before trying to query HAL about it and give a useful error message if it wa... Original commit message from CVS: * ext/hal/gsthalaudiosink.c: (do_toggle_element): * ext/hal/gsthalaudiosrc.c: (do_toggle_element): Check if the device UDI is set before trying to query HAL about it and give a useful error message if it wasn't set. * ext/hal/hal.c: (gst_hal_get_string): Don't query HAL for NULL UDIs. Passing NULL as UDI to HAL gives an assertion failure in D-Bus when running with DBUS_FATAL_WARNINGS=1. --- ChangeLog | 11 +++++++++++ common | 2 +- ext/hal/gsthalaudiosink.c | 6 +++++- ext/hal/gsthalaudiosrc.c | 6 +++++- ext/hal/hal.c | 6 ++++++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b8a913d..4c07c6b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-03-01 Sebastian Dröge + + * ext/hal/gsthalaudiosink.c: (do_toggle_element): + * ext/hal/gsthalaudiosrc.c: (do_toggle_element): + Check if the device UDI is set before trying to query HAL + about it and give a useful error message if it wasn't set. + * ext/hal/hal.c: (gst_hal_get_string): + Don't query HAL for NULL UDIs. Passing NULL as UDI to HAL + gives an assertion failure in D-Bus when running with + DBUS_FATAL_WARNINGS=1. + 2007-02-28 Thomas Vander Stichele * configure.ac: diff --git a/common b/common index 54c2a701..9a56e28f 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 54c2a701c28dcddaf051abf09a360223acd096c9 +Subproject commit 9a56e28fc15440eb6852411321c46312e1d1bb73 diff --git a/ext/hal/gsthalaudiosink.c b/ext/hal/gsthalaudiosink.c index ea3c4066..1b941aa0 100644 --- a/ext/hal/gsthalaudiosink.c +++ b/ext/hal/gsthalaudiosink.c @@ -162,7 +162,11 @@ do_toggle_element (GstHalAudioSink * sink) } GST_DEBUG_OBJECT (sink, "Creating new kid"); - if (!(sink->kid = gst_hal_get_audio_sink (sink->udi))) { + if (!sink->udi) { + GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL), + ("No UDI set for device")); + return FALSE; + } else if (!(sink->kid = gst_hal_get_audio_sink (sink->udi))) { GST_ELEMENT_ERROR (sink, LIBRARY, SETTINGS, (NULL), ("Failed to render audio sink from Hal")); return FALSE; diff --git a/ext/hal/gsthalaudiosrc.c b/ext/hal/gsthalaudiosrc.c index f57e963e..ed887544 100644 --- a/ext/hal/gsthalaudiosrc.c +++ b/ext/hal/gsthalaudiosrc.c @@ -164,7 +164,11 @@ do_toggle_element (GstHalAudioSrc * src) } GST_DEBUG_OBJECT (src, "Creating new kid"); - if (!(src->kid = gst_hal_get_audio_src (src->udi))) { + if (!src->udi) { + GST_ELEMENT_ERROR (src, LIBRARY, SETTINGS, (NULL), + ("No UDI set for device")); + return FALSE; + } else if (!(src->kid = gst_hal_get_audio_src (src->udi))) { GST_ELEMENT_ERROR (src, LIBRARY, SETTINGS, (NULL), ("Failed to render audio source from Hal")); return FALSE; diff --git a/ext/hal/hal.c b/ext/hal/hal.c index 519258d6..57da8425 100644 --- a/ext/hal/hal.c +++ b/ext/hal/hal.c @@ -50,6 +50,12 @@ gst_hal_get_string (const gchar * udi) LibHalContext *ctx; char *string; + /* Don't query HAL for NULL UDIs. Passing NULL as UDI to HAL gives + * an assertion failure in D-Bus when running with + * DBUS_FATAL_WARNINGS=1. */ + if (!udi) + return NULL; + dbus_error_init (&error); connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error); -- cgit