[at-spi2-core] Check failure of dbus_connection_send_with_reply()



commit 54d3b53515eb2ddbef32ad12446bd8c9fd731c3f
Author: Daiki Ueno <dueno src gnome org>
Date:   Thu Sep 11 17:00:55 2014 +0900

    Check failure of dbus_connection_send_with_reply()

 atspi/atspi-misc.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index f698544..4c35df8 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -215,9 +215,11 @@ handle_get_bus_address (DBusPendingCall *pending, void *user_data)
                                           "/org/a11y/atspi/cache",
                                           atspi_interface_cache, "GetItems");
 
-   dbus_connection_send_with_reply (app->bus, message, &new_pending, 2000);
-  dbus_pending_call_set_notify (new_pending, handle_get_items, app, NULL);
+  dbus_connection_send_with_reply (app->bus, message, &new_pending, 2000);
   dbus_message_unref (message);
+  if (!new_pending)
+    return;
+  dbus_pending_call_set_notify (new_pending, handle_get_items, app, NULL);
 }
 
 static AtspiApplication *
@@ -247,9 +249,14 @@ get_application (const char *bus_name)
   message = dbus_message_new_method_call (bus_name, atspi_path_root,
                                           atspi_interface_application, "GetApplicationBusAddress");
 
-   dbus_connection_send_with_reply (app->bus, message, &pending, 2000);
-  dbus_pending_call_set_notify (pending, handle_get_bus_address, app, NULL);
+  dbus_connection_send_with_reply (app->bus, message, &pending, 2000);
   dbus_message_unref (message);
+  if (!pending)
+  {
+    g_hash_table_remove (app_hash, bus_name_dup);
+    return NULL;
+  }
+  dbus_pending_call_set_notify (pending, handle_get_bus_address, app, NULL);
   return app;
 }
 


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