[at-spi2-core/gnome-3-18] get_index_in_parent: Don't crash if parent is defunct



commit 653f6b3437b6c2561e8da84a0371dd298be62a7c
Author: Mike Gorse <mgorse suse com>
Date:   Mon Nov 9 17:03:13 2015 -0600

    get_index_in_parent: Don't crash if parent is defunct

 atspi/atspi-accessible.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c
index 85970d2..ceaedb5 100644
--- a/atspi/atspi-accessible.c
+++ b/atspi/atspi-accessible.c
@@ -399,11 +399,15 @@ atspi_accessible_get_index_in_parent (AtspiAccessible *obj, GError **error)
     if (!obj->accessible_parent)
       return -1;
 
+    if (!_atspi_accessible_test_cache (obj->accessible_parent, ATSPI_CACHE_CHILDREN) || 
!obj->accessible_parent->children)
+        goto dbus;
+
     for (i = 0; i < obj->accessible_parent->children->len; i++)
       if (g_ptr_array_index (obj->accessible_parent->children, i) == obj)
         return i;
   }
 
+dbus:
   _atspi_dbus_call (obj, atspi_interface_accessible,
                     "GetIndexInParent", NULL, "=>i", &ret);
   return ret;


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