Update MAINTAINERS
[platform/upstream/at-spi2-core.git] / dbind / dbind.c
index f10b9cd..9d7304e 100644 (file)
@@ -68,20 +68,24 @@ dbind_send_and_allow_reentry (DBusConnection * bus, DBusMessage * message, DBusE
   const char *destination = dbus_message_get_destination (message);
   struct timeval tv;
   DBusMessage *ret;
+  static gboolean in_dispatch = FALSE;
 
   if (unique_name && destination &&
       strcmp (destination, unique_name) != 0)
     {
       ret = dbus_connection_send_with_reply_and_block (bus, message,
                                                        dbind_timeout, error);
-      if (g_main_depth () == 0)
-      while (dbus_connection_dispatch (bus) == DBUS_DISPATCH_DATA_REMAINS);
+      if (g_main_depth () == 0 && !in_dispatch)
+      {
+        in_dispatch = TRUE;
+        while (dbus_connection_dispatch (bus) == DBUS_DISPATCH_DATA_REMAINS);
+        in_dispatch = FALSE;
+      }
       return ret;
     }
 
   closure = g_new0 (SpiReentrantCallClosure, 1);
   closure->reply = NULL;
-  atspi_dbus_connection_setup_with_g_main(bus, NULL);
   if (!dbus_connection_send_with_reply (bus, message, &pending, dbind_timeout)
       || !pending)
     {
@@ -158,7 +162,6 @@ dbind_method_call_reentrant_va (DBusConnection *cnx,
 
     if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
     {
-      const char *name = dbus_message_get_error_name (reply);
       goto out;
     }
     /* demarshal */
@@ -242,6 +245,7 @@ dbind_method_call_reentrant (DBusConnection *cnx,
 
 /*---------------------------------------------------------------------------*/
 
+/* TODO: opt_error is unused; should be removed */
 dbus_bool_t
 dbind_emit_signal_va (DBusConnection *cnx,
                       const char     *path,
@@ -254,17 +258,8 @@ dbind_emit_signal_va (DBusConnection *cnx,
     dbus_bool_t success = FALSE;
     DBusMessage *msg = NULL;
     DBusMessageIter iter;
-    DBusError *err, real_err;
     const char *p;
 
-    dbus_error_init (&real_err);
-
-    if (opt_error)
-        err = opt_error;
-    else {
-        err = &real_err;
-    }
-
     msg = dbus_message_new_signal (path, interface, signal);
     if (!msg)
         goto out;
@@ -282,9 +277,6 @@ out:
     if (msg)
         dbus_message_unref (msg);
 
-    if (dbus_error_is_set (&real_err))
-        dbus_error_free (&real_err);
-
     return success;
 }