Disable caching if ATSPI_NO_CACHE is set in the environment and not 0
authorMike Gorse <mgorse@novell.com>
Tue, 24 May 2011 22:15:13 +0000 (17:15 -0500)
committerMike Gorse <mgorse@novell.com>
Tue, 24 May 2011 22:15:13 +0000 (17:15 -0500)
atspi/atspi-accessible.c
atspi/atspi-misc-private.h
atspi/atspi-misc.c

index 2a42d41..82ee43d 100644 (file)
@@ -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
index 8c91e83..865ab5f 100644 (file)
@@ -185,4 +185,5 @@ typedef enum
 } AtspiError;
 
 extern GMainLoop *atspi_main_loop;
+extern gboolean atspi_no_cache;
 #endif /* _ATSPI_MISC_PRIVATE_H_ */
index 5012107..eef82d1 100644 (file)
@@ -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;
 }