From 09915497d014e3ea9a146fa6ef8eb4fa94756708 Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Mon, 19 Nov 2012 15:34:26 -0600 Subject: [PATCH] Fix atspi_accessible_get_index_in_parent when the parent is not cached 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index 92f74e7..7971bd3 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -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; -- 2.7.4