[at-spi2-atk] When switching the main context, move pending register_application call
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [at-spi2-atk] When switching the main context, move pending register_application call
- Date: Thu, 15 Aug 2019 16:05:42 +0000 (UTC)
commit 895abb449fa9c521098e8135defe4882a0595e9e
Author: Mike Gorse <mgorse alum wpi edu>
Date: Thu Aug 15 11:01:47 2019 -0500
When switching the main context, move pending register_application call
Commit f603c8 broke java-atk-wrapper, since the default main loop context
isn't used there.
Fixes https://gitlab.gnome.org/GNOME/at-spi2-core/issues/16
atk-adaptor/bridge.c | 18 +++++++++++++-----
atk-adaptor/bridge.h | 3 +++
atk-adaptor/event.c | 6 ++++++
3 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c
index c8ca861..fe09e84 100644
--- a/atk-adaptor/bridge.c
+++ b/atk-adaptor/bridge.c
@@ -403,8 +403,8 @@ register_reply (DBusPendingCall *pending, void *user_data)
get_registered_event_listeners (spi_global_app_data);
}
-static gboolean
-register_application (gpointer data)
+gboolean
+_atk_bridge_register_application (gpointer data)
{
SpiBridge * app = data;
DBusMessage *message;
@@ -476,6 +476,13 @@ deregister_application (SpiBridge * app)
DBusMessageIter iter;
const char *uname;
+ if (spi_global_app_data->registration_pending)
+ {
+ g_source_remove (spi_global_app_data->registration_pending);
+ spi_global_app_data->registration_pending = 0;
+ return;
+ }
+
message = dbus_message_new_method_call (SPI_DBUS_NAME_REGISTRY,
ATSPI_DBUS_PATH_REGISTRY,
ATSPI_DBUS_INTERFACE_REGISTRY,
@@ -849,7 +856,7 @@ signal_filter (DBusConnection *bus, DBusMessage *message, void *user_data)
{
if (registry_lost && !old[0])
{
- register_application (spi_global_app_data);
+ _atk_bridge_register_application (spi_global_app_data);
registry_lost = FALSE;
}
else if (!new[0])
@@ -1102,8 +1109,9 @@ atk_bridge_adaptor_init (gint * argc, gchar ** argv[])
NULL);
/* Register this app by sending a signal out to AT-SPI registry daemon */
- if (!atspi_no_register && (!root || !ATK_IS_PLUG (root)))
- g_idle_add (register_application, spi_global_app_data);
+ if (!atspi_no_register && (!root || !ATK_IS_PLUG (root)) &&
+ !spi_global_app_data->registration_pending)
+ spi_global_app_data->registration_pending = spi_idle_add (_atk_bridge_register_application,
spi_global_app_data);
else
get_registered_event_listeners (spi_global_app_data);
diff --git a/atk-adaptor/bridge.h b/atk-adaptor/bridge.h
index 64882e4..29518b0 100644
--- a/atk-adaptor/bridge.h
+++ b/atk-adaptor/bridge.h
@@ -73,6 +73,7 @@ gchar *app_bus_addr;
GList *events;
gboolean events_initialized;
GHashTable *property_hash;
+ guint registration_pending;
};
extern SpiBridge *spi_global_app_data;
@@ -92,6 +93,8 @@ DRoutePropertyFunction _atk_bridge_find_property_func (const char *property,
GType *type);
GType _atk_bridge_type_from_iface (const char *iface);
+
+gboolean _atk_bridge_register_application (gpointer data);
G_END_DECLS
#endif /* BRIDGE_H */
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c
index 7c3c3f9..e9e906f 100644
--- a/atk-adaptor/event.c
+++ b/atk-adaptor/event.c
@@ -72,6 +72,12 @@ switch_main_context (GMainContext *cnx)
atspi_set_main_context (cnx);
for (list = spi_global_app_data->direct_connections; list; list = list->next)
atspi_dbus_connection_setup_with_g_main (list->data, cnx);
+
+ if (spi_global_app_data->registration_pending)
+ {
+ g_source_remove (spi_global_app_data->registration_pending);
+ spi_global_app_data->registration_pending = spi_idle_add (_atk_bridge_register_application,
spi_global_app_data);
+ }
}
guint
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]