[at-spi2-atk] Don't cache objects that return NULL when their state set is queried



commit 9bf59744dc2547f79de03ed7f55ab3ea077bfa4d
Author: Mike Gorse <mgorse novell com>
Date:   Mon Feb 6 16:35:43 2012 -0600

    Don't cache objects that return NULL when their state set is queried
    
    If atk_object_ref_state_set returns NULL, then perhaps the object is
    going away or not yet initialized, so caching it may not be a good idea.
    Also stops some warnings.

 atk-adaptor/accessible-cache.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/atk-adaptor/accessible-cache.c b/atk-adaptor/accessible-cache.c
index 943a320..20796d5 100644
--- a/atk-adaptor/accessible-cache.c
+++ b/atk-adaptor/accessible-cache.c
@@ -281,7 +281,7 @@ add_pending_items (gpointer data)
       current = g_queue_pop_head (cache->add_traversal);
       set = atk_object_ref_state_set (current);
 
-      if (!atk_state_set_contains_state (set, ATK_STATE_TRANSIENT))
+      if (set && !atk_state_set_contains_state (set, ATK_STATE_TRANSIENT))
         {
 	  g_queue_push_tail (to_add, current);
           if (!spi_cache_in (cache, G_OBJECT (current)) &&
@@ -292,7 +292,8 @@ add_pending_items (gpointer data)
             }
         }
 
-      g_object_unref (set);
+      if (set)
+        g_object_unref (set);
     }
 
   while (!g_queue_is_empty (to_add))



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