[at-spi2-core] Call g_error if unable to find the accessibility bus



commit 112afd0b8d8404b7b74549eae867f5f4f8276289
Author: Mike Gorse <mgorse linux-l2tz site>
Date:   Fri May 6 10:59:45 2011 -0500

    Call g_error if unable to find the accessibility bus
    
    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 |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index 1f51fa9..720970a 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]