atspi_accessible_get_parent: move check for NULL AtspiApplication object
authorMike Gorse <mgorse@suse.com>
Mon, 8 May 2017 23:59:40 +0000 (18:59 -0500)
committerMike Gorse <mgorse@suse.com>
Mon, 8 May 2017 23:59:40 +0000 (18:59 -0500)
Now, if we don't have a cached parent, then we always either return NULL
or make a D-Bus call. This might make the code more robust, and hoping
that it will fix https://bugzilla.gnome.org/show_bug.cgi?id=767074,
though in theory it should make no difference there.

atspi/atspi-accessible.c

index 4547ef7..b84317f 100644 (file)
@@ -268,11 +268,12 @@ atspi_accessible_get_parent (AtspiAccessible *obj, GError **error)
 {
   g_return_val_if_fail (obj != NULL, NULL);
 
-  if (obj->parent.app &&
-      !_atspi_accessible_test_cache (obj, ATSPI_CACHE_PARENT))
+  if (!_atspi_accessible_test_cache (obj, ATSPI_CACHE_PARENT))
   {
     DBusMessage *message, *reply;
     DBusMessageIter iter, iter_variant;
+    if (!obj->parent.app)
+      return NULL;
     message = dbus_message_new_method_call (obj->parent.app->bus_name,
                                             obj->parent.path,
                                             DBUS_INTERFACE_PROPERTIES, "Get");