Ensure that an object is registered before adding it to the cache
authorMike Gorse <mgorse@novell.com>
Mon, 16 Aug 2010 22:21:06 +0000 (18:21 -0400)
committerMike Gorse <mgorse@novell.com>
Mon, 16 Aug 2010 22:21:06 +0000 (18:21 -0400)
We need to ensure that an object is registered before putting it in the
cache, since registering the object adds the weak_ref that we use to know
when the object should be removed from the cache.  Prevents a crash in
GetItems.

atk-adaptor/accessible-cache.c

index 5352217..f282d55 100644 (file)
@@ -287,6 +287,11 @@ add_pending_items (gpointer data)
   while (!g_queue_is_empty (to_add))
     {
       current = g_queue_pop_head (to_add);
+
+      /* Make sure object is registerd so we are notified if it goes away */
+      g_free (spi_register_object_to_path (spi_global_register,
+              G_OBJECT (current)));
+
       add_object (cache, G_OBJECT(current));
       g_object_unref (G_OBJECT (current));
     }