X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=atk-adaptor%2Fbridge.c;h=a1ee202adff10bd4ce56ff4770ce94b8b58f21c7;hb=770fcb6cf42143eebe5ebd9660a1c8737edaca6b;hp=bcae3b96bcce62e0c345fea4abe9df4829a3d05a;hpb=20958d891139849067a0e784e04c35cc3c575c3d;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c index bcae3b9..a1ee202 100644 --- a/atk-adaptor/bridge.c +++ b/atk-adaptor/bridge.c @@ -54,6 +54,9 @@ /*---------------------------------------------------------------------------*/ +static DBusHandlerResult +signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data); + SpiBridge *spi_global_app_data = NULL; /*static Display *bridge_display = NULL;*/ @@ -301,28 +304,6 @@ deregister_application (SpiBridge * app) /*---------------------------------------------------------------------------*/ -static void -exit_func (void) -{ - if (!spi_global_app_data) - { - return; - } - - spi_atk_tidy_windows (); - spi_atk_deregister_event_listeners (); - deregister_application (spi_global_app_data); - - g_free (spi_global_app_data); - spi_global_app_data = NULL; - - /* Not currently creating an XDisplay */ -#if 0 - if (bridge_display) - XCloseDisplay (bridge_display); -#endif -} - /*---------------------------------------------------------------------------*/ static AtkPlugClass *plug_class; @@ -353,17 +334,19 @@ socket_ref_state_set (AtkObject *accessible) DBusMessageIter iter, iter_array; AtkStateSet *set; + set = atk_state_set_new (); + if (!socket->embedded_plug_id) - return NULL; + return set; child_name = g_strdup (socket->embedded_plug_id); if (!child_name) - return NULL; + return set; child_path = g_utf8_strchr (child_name + 1, -1, ':'); if (!child_path) { g_free (child_name); - return NULL; + return set; } *(child_path++) = '\0'; message = dbus_message_new_method_call (child_name, child_path, ATSPI_DBUS_INTERFACE_ACCESSIBLE, "GetState"); @@ -371,15 +354,13 @@ socket_ref_state_set (AtkObject *accessible) reply = dbus_connection_send_with_reply_and_block (spi_global_app_data->bus, message, 1, NULL); dbus_message_unref (message); if (reply == NULL) - return NULL; + return set; if (strcmp (dbus_message_get_signature (reply), "au") != 0) { dbus_message_unref (reply); - return NULL; + return set; } - set = atk_state_set_new (); - if (!set) - return NULL; + dbus_message_iter_init (reply, &iter); dbus_message_iter_recurse (&iter, &iter_array); do @@ -498,9 +479,7 @@ new_connection_cb (DBusServer *server, DBusConnection *con, void *data) droute_intercept_dbus (con); droute_context_register (spi_global_app_data->droute, con); - new_list = g_list_append (spi_global_app_data->direct_connections, con); - if (new_list) - spi_global_app_data->direct_connections = new_list; + spi_global_app_data->direct_connections = g_list_append (spi_global_app_data->direct_connections, con); } static int @@ -851,8 +830,53 @@ gnome_accessibility_module_init (void) void gnome_accessibility_module_shutdown (void) { + GList *l; + + if (!spi_global_app_data) + return; + + spi_atk_tidy_windows (); spi_atk_deregister_event_listeners (); - exit_func (); + + deregister_application (spi_global_app_data); + + if (spi_global_app_data->bus) + { + dbus_connection_remove_filter (spi_global_app_data->bus, signal_filter, NULL); + droute_context_unregister (spi_global_app_data->droute, spi_global_app_data->bus); + dbus_connection_unref (spi_global_app_data->bus); + } + + for (l = spi_global_app_data->direct_connections; l; l = l->next) + { + droute_context_unregister (spi_global_app_data->droute, l->data); + droute_unintercept_dbus (l->data); + dbus_connection_unref (l); + } + g_list_free (spi_global_app_data->direct_connections); + + for (l = clients; l; l = l->next) + g_free (l->data); + g_list_free (clients); + clients = NULL; + + g_object_unref (spi_global_cache); + g_object_unref (spi_global_leasing); + g_object_unref (spi_global_register); + + if (spi_global_app_data->main_context) + g_main_context_unref (spi_global_app_data->main_context); + + droute_free (spi_global_app_data->droute); + + g_free (spi_global_app_data); + spi_global_app_data = NULL; + + /* Not currently creating an XDisplay */ +#if 0 + if (bridge_display) + XCloseDisplay (bridge_display); +#endif } static gchar *name_match_tmpl =