X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=atk-adaptor%2Fbridge.c;h=cbced24f7be394c8c1e1ce64d662623385374fad;hb=3e0c62d4a264434cc5d49b5d4a054312c92330a0;hp=489f1b1b0a26bb547291a4b3858942c37d2f0dda;hpb=c22a02deaa59a6568c989df606cf84b3860933d3;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c index 489f1b1..cbced24 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); @@ -408,6 +433,9 @@ adaptor_init (gint * argc, gchar ** argv[]) dbus_connection_setup_with_g_main (spi_global_app_data->bus, g_main_context_default ()); + /* Hook our plug-and socket functions */ + install_plug_hooks (); + /* * Create the leasing, register and cache objects. * The order is important here, the cache depends on the @@ -458,9 +486,6 @@ adaptor_init (gint * argc, gchar ** argv[]) /* Register methods to send D-Bus signals on certain ATK events */ spi_atk_register_event_listeners (); - /* Hook our plug-and socket functions */ - install_plug_hooks (); - /* Register this app by sending a signal out to AT-SPI registry daemon */ if (!atspi_no_register && (!root || !ATK_IS_PLUG (root))) register_application (spi_global_app_data);