[at-spi2-core] Disable caching if ATSPI_NO_CACHE is set in the environment and not 0



commit a92e14b38b5bad10f97aa3f59e681ca4a233579d
Author: Mike Gorse <mgorse novell com>
Date:   Tue May 24 17:15:13 2011 -0500

    Disable caching if ATSPI_NO_CACHE is set in the environment and not 0

 atspi/atspi-accessible.c   |    2 +-
 atspi/atspi-misc-private.h |    1 +
 atspi/atspi-misc.c         |    6 ++++++
 3 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 2a42d41..82ee43d 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -1444,7 +1444,7 @@ _atspi_accessible_test_cache (AtspiAccessible *accessible, AtspiCache flag)
 {
   AtspiCache mask = _atspi_accessible_get_cache_mask (accessible);
   AtspiCache result = accessible->cached_properties & mask & flag;
-  return (result != 0 && atspi_main_loop);
+  return (result != 0 && atspi_main_loop && !atspi_no_cache);
 }
 
 void
diff --git a/atspi/atspi-misc-private.h b/atspi/atspi-misc-private.h
index 8c91e83..865ab5f 100644
--- a/atspi/atspi-misc-private.h
+++ b/atspi/atspi-misc-private.h
@@ -185,4 +185,5 @@ typedef enum
 } AtspiError;
 
 extern GMainLoop *atspi_main_loop;
+extern gboolean atspi_no_cache;
 #endif	/* _ATSPI_MISC_PRIVATE_H_ */
diff --git a/atspi/atspi-misc.c b/atspi/atspi-misc.c
index 5012107..eef82d1 100644
--- a/atspi/atspi-misc.c
+++ b/atspi/atspi-misc.c
@@ -40,6 +40,7 @@ static DBusConnection *bus = NULL;
 static GHashTable *live_refs = NULL;
 
 GMainLoop *atspi_main_loop;
+gboolean atspi_no_cache;
 
 const char *atspi_path_dec = ATSPI_DBUS_PATH_DEC;
 const char *atspi_path_registry = ATSPI_DBUS_PATH_REGISTRY;
@@ -822,6 +823,7 @@ atspi_init (void)
 {
   DBusError error;
   char *match;
+  const gchar *no_cache;
 
   if (atspi_inited)
     {
@@ -858,6 +860,10 @@ atspi_init (void)
   match = g_strdup_printf ("type='signal',interface='%s',member='StateChanged'", atspi_interface_event_object);
   dbus_bus_add_match (bus, match, &error);
   g_free (match);
+
+  no_cache = g_getenv ("ATSPI_NO_CACHE");
+  if (no_cache && g_strcmp0 (no_cache, "0") != 0)
+    atspi_no_cache = TRUE;
   return 0;
 }
 



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