[at-spi2-atk] Fix atk-adaptor re-entry problem during register application.



commit 6a8edfe0f6b1be3cd0532528ee1d3c2b1ef35292
Author: Li Yuan <liyuan tackle prc sun com>
Date:   Thu Apr 15 14:28:14 2010 +0800

    Fix atk-adaptor re-entry problem during register application.
    
    Bug #27626.

 atk-adaptor/bridge.c |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
index 489f1b1..dd66515 100644
--- a/atk-adaptor/bridge.c
+++ b/atk-adaptor/bridge.c
@@ -156,6 +156,31 @@ spi_atk_bridge_get_bus (void)
   return bus;
 }
 
+static void
+set_reply (DBusPendingCall *pending, void *user_data)
+{
+    void **replyptr = (void **)user_data;
+
+    *replyptr = dbus_pending_call_steal_reply (pending);
+}
+
+static DBusMessage *
+send_and_allow_reentry (DBusConnection *bus, DBusMessage *message, DBusError *error)
+{
+    DBusPendingCall *pending;
+    DBusMessage *reply = NULL;
+
+    if (!dbus_connection_send_with_reply (bus, message, &pending, -1))
+    {
+        return NULL;
+    }
+    dbus_pending_call_set_notify (pending, set_reply, (void *)&reply, NULL);
+    while (!reply)
+    {
+      if (!dbus_connection_read_write_dispatch (bus, -1)) return NULL;
+    }
+    return reply;
+}
 /*---------------------------------------------------------------------------*/
 
 static gboolean
@@ -174,8 +199,8 @@ register_application (SpiBridge * app)
 
   dbus_message_iter_init_append (message, &iter);
   spi_object_append_reference (&iter, app->root);
-
-  reply = dbus_connection_send_with_reply_and_block (app->bus, message, -1, &error);
+  
+  reply = send_and_allow_reentry (app->bus, message, &error);
 
   if (message)
     dbus_message_unref (message);



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