ext/hal/: Check if the device UDI is set before trying to query HAL about it and...
authorSebastian Dröge <slomo@circular-chaos.org>
Thu, 1 Mar 2007 01:48:59 +0000 (01:48 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Thu, 1 Mar 2007 01:48:59 +0000 (01:48 +0000)
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
common
ext/hal/gsthalaudiosink.c
ext/hal/gsthalaudiosrc.c
ext/hal/hal.c

index 1b8a913d2d798a646b94c3f64e9f0eaea890f6ae..4c07c6b43a7f298676cc51421be2520becfe0107 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-03-01  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * 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  <thomas at apestaart dot org>
 
        * configure.ac:
diff --git a/common b/common
index 54c2a701c28dcddaf051abf09a360223acd096c9..9a56e28fc15440eb6852411321c46312e1d1bb73 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 54c2a701c28dcddaf051abf09a360223acd096c9
+Subproject commit 9a56e28fc15440eb6852411321c46312e1d1bb73
index ea3c406663222d5cf2c0620450f9dd8db429ce91..1b941aa0c5b6217e4be58f9a97c91645c475002d 100644 (file)
@@ -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;
index f57e963eb5426c68b1c28594223bb8c5413333b7..ed8875443d87bed1caff5403788be15efe157a9b 100644 (file)
@@ -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;
index 519258d6d2ca3a8053d061efe18115b01c5d6544..57da8425ec438f7c9d4ef5652eeb4fba45492c4c 100644 (file)
@@ -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);