Commit 0bde58ff authored by Emmanuele Bassi's avatar Emmanuele Bassi

a11y: Avoid signal emission during cache population

If we're responding to a request to get all the cached items, there's no
need to emit signals when adding an ATContext to the cache.
parent 40446201
......@@ -58,6 +58,9 @@ struct _GtkAtSpiCache
/* HashTable<GtkAtSpiContext, str> */
GHashTable *contexts_to_path;
/* Re-entrancy guard */
gboolean in_get_items;
......@@ -250,10 +253,17 @@ handle_cache_method (GDBusConnection *connection,
/* Prevent the emission os signals while collecting accessible
* objects as the result of walking the accessible tree
self->in_get_items = TRUE;
g_variant_builder_open (&builder, G_VARIANT_TYPE (GET_ITEMS_SIGNATURE));
collect_cached_objects (self, &builder);
g_variant_builder_close (&builder);
self->in_get_items = FALSE;
g_dbus_method_invocation_return_value (invocation, g_variant_builder_end (&builder));
......@@ -371,7 +381,11 @@ gtk_at_spi_cache_add_context (GtkAtSpiCache *self,
GTK_NOTE (A11Y, g_message ("Adding context '%s' to cache", path_key));
emit_add_accessible (self, context);
/* GetItems is safe from re-entrancy, but we still don't want to
* emit an unnecessary signal while we're collecting ATContexts
if (!self->in_get_items)
emit_add_accessible (self, context);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment