Fix atspi_accessible_get_index_in_parent when the parent is not cached
authorMike Gorse <mgorse@suse.com>
Mon, 19 Nov 2012 21:34:26 +0000 (15:34 -0600)
committerMike Gorse <mgorse@suse.com>
Mon, 19 Nov 2012 21:34:26 +0000 (15:34 -0600)
Atspi_accessible_get_index_in_parent was returning -1 if the object's
parent is NULL, regardless of whether the accessible_parent field is
currently valid.

https://bugzilla.gnome.org/show_bug.cgi?id=688057

atspi/atspi-accessible.c

index 92f74e7..7971bd3 100644 (file)
@@ -489,8 +489,11 @@ atspi_accessible_get_index_in_parent (AtspiAccessible *obj, GError **error)
   gint i = 0;
 
   g_return_val_if_fail (obj != NULL, -1);
-  if (!obj->accessible_parent) return -1;
-  if (!_atspi_accessible_test_cache (obj->accessible_parent,
+  if (_atspi_accessible_test_cache (obj, ATSPI_CACHE_PARENT) &&
+      !obj->accessible_parent)
+    return -1;
+  if (!obj->accessible_parent ||
+      !_atspi_accessible_test_cache (obj->accessible_parent,
                                      ATSPI_CACHE_CHILDREN))
   {
     dbus_int32_t ret = -1;