From 06027ba5226ae4f57f9786a65ec6c98469828b46 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Thu, 29 Sep 2022 14:40:49 -0500 Subject: Wait for the test-application startup using an atspi listener This should be more robust than just waiting and sleeping. * test-application now claims a different DBus name for each run, to disambiguate. * atk_bridge_adaptor_cleanup() - release the dbus name if there was one --- atk-adaptor/bridge.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'atk-adaptor') diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c index a2b1de83..462ec0a3 100644 --- a/atk-adaptor/bridge.c +++ b/atk-adaptor/bridge.c @@ -686,7 +686,7 @@ new_connection_cb (DBusServer *server, DBusConnection *con, void *data) spi_global_app_data->direct_connections = g_list_append (spi_global_app_data->direct_connections, con); } -gchar *atspi_dbus_name = NULL; +static gchar *atspi_dbus_name = NULL; static gboolean atspi_no_register = FALSE; static GOptionEntry atspi_option_entries[] = { @@ -1222,6 +1222,26 @@ atk_bridge_adaptor_cleanup (void) { 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); + + if (atspi_dbus_name != NULL) + { + DBusError error; + int result; + + dbus_error_init (&error); + result = dbus_bus_release_name (spi_global_app_data->bus, atspi_dbus_name, &error); + if (result == -1) + { + g_warning ("atk-bridge: could not release dbus name: %s", error.message); + } + else + { + g_print ("bridge: released name, result %d\n", result); + } + + dbus_error_free (&error); + } + dbus_connection_close (spi_global_app_data->bus); dbus_connection_unref (spi_global_app_data->bus); spi_global_app_data->bus = NULL; -- cgit v1.2.1