Call g_error if unable to find the accessibility bus
authorMike Gorse <mgorse@linux-l2tz.site>
Fri, 6 May 2011 15:59:45 +0000 (10:59 -0500)
committerMike Gorse <mgorse@linux-l2tz.site>
Fri, 6 May 2011 16:02:55 +0000 (11:02 -0500)
Previously, AT-SPI would wind up passing a NULL connection to libdbus if it
couldn't connect to the bus, causing a cryptic abort.  This change makes it
at least abort with a sensible error message in that case.
Also, if unable to find the accessibility bus address via the session bus,
save and print the DBusError, if any.

atspi/atspi-misc.c

index 1f51fa9..720970a 100644 (file)
@@ -112,6 +112,8 @@ _atspi_bus ()
 {
   if (!bus)
     atspi_init ();
+  if (!bus)
+    g_error ("AT-SPI: COuldn't connect to accessibility bus. Is at-spi-bus-launcher running?");
   return bus;
 }
 
@@ -1290,6 +1292,7 @@ get_accessibility_bus_address_dbus (void)
   DBusConnection *session_bus = NULL;
   DBusMessage *message;
   DBusMessage *reply;
+  DBusError error;
   char *address = NULL;
 
   session_bus = dbus_bus_get (DBUS_BUS_SESSION, NULL);
@@ -1301,14 +1304,20 @@ get_accessibility_bus_address_dbus (void)
                                          "org.a11y.Bus",
                                          "GetAddress");
 
+  dbus_error_init (&error);
   reply = dbus_connection_send_with_reply_and_block (session_bus,
                                                     message,
                                                     -1,
-                                                    NULL);
+                                                    &error);
   dbus_message_unref (message);
 
   if (!reply)
+  {
+    g_warning ("Error retrieving accessibility bus address: %s: %s",
+               error.name, error.message);
+    dbus_error_init (&error);
     return NULL;
+  }
   
   {
     const char *tmp_address;