[gtk/ebassi/for-master: 2/2] a11y: Cache the accessibility bus address




commit 21432f0565b5c30f3def78835b6afa4f8bd737f5
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Nov 22 18:40:50 2020 +0000

    a11y: Cache the accessibility bus address
    
    Just check for it once; doing it every time we failed to create an
    ATContext is just going to fill up the logs.

 gtk/a11y/gtkatspicontext.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gtk/a11y/gtkatspicontext.c b/gtk/a11y/gtkatspicontext.c
index 3216c33a40..605df73a66 100644
--- a/gtk/a11y/gtkatspicontext.c
+++ b/gtk/a11y/gtkatspicontext.c
@@ -1711,9 +1711,14 @@ gtk_at_spi_create_context (GtkAccessibleRole  accessible_role,
   g_return_val_if_fail (GTK_IS_ACCESSIBLE (accessible), NULL);
   g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
 
-  const char *bus_address = get_bus_address (display);
+  static const char *bus_address;
 
   if (bus_address == NULL)
+    bus_address = get_bus_address (display);
+  else
+    bus_address = "";
+
+  if (*bus_address == '\0')
     return NULL;
 
 #if defined(GDK_WINDOWING_WAYLAND)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]