changeset 4629:d239bf252eac

Print a warning instead of mysterious dbus-glib assertion failures when proxy is NULL in mpris_player_init().
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 11 Jun 2008 18:00:29 +0300
parents 8399067f9b1a
children 64c40b3e69f4
files src/audacious/dbus.c
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/dbus.c	Wed Jun 11 17:28:03 2008 +0300
+++ b/src/audacious/dbus.c	Wed Jun 11 18:00:29 2008 +0300
@@ -137,14 +137,19 @@
                                         AUDACIOUS_DBUS_PATH_MPRIS_PLAYER,
                                         G_OBJECT(object));
 
-	// Add signals
-	DBusGProxy *proxy = object->proxy;
-	dbus_g_proxy_add_signal(proxy, "StatusChange",
-			G_TYPE_INT, G_TYPE_INVALID);
-	dbus_g_proxy_add_signal(proxy, "CapsChange",
-			G_TYPE_INT, G_TYPE_INVALID);
-	dbus_g_proxy_add_signal(proxy, "TrackChange",
-			DBUS_TYPE_G_STRING_VALUE_HASHTABLE, G_TYPE_INVALID);
+    // Add signals
+    DBusGProxy *proxy = object->proxy;
+    if (proxy != NULL) {
+        dbus_g_proxy_add_signal(proxy, "StatusChange",
+            G_TYPE_INT, G_TYPE_INVALID);
+        dbus_g_proxy_add_signal(proxy, "CapsChange",
+            G_TYPE_INT, G_TYPE_INVALID);
+        dbus_g_proxy_add_signal(proxy, "TrackChange",
+            DBUS_TYPE_G_STRING_VALUE_HASHTABLE, G_TYPE_INVALID);
+    } else {
+        /* XXX / FIXME: Why does this happen? -- ccr */
+        g_warning("in mpris_player_init object->proxy == NULL, not adding some signals.");
+    }
 }
 
 void mpris_tracklist_init(MprisTrackList *object) {