From f2d5fab0b2d7802723b9104f3abd57bb30dd2a66 Mon Sep 17 00:00:00 2001 From: Mike Gorse Date: Mon, 18 Apr 2011 05:07:14 -0500 Subject: [PATCH] Fix for BGO#648059: get_application should return something w/ROLE_APPLICATION atspi_accessible_get_application will walk up the tree until it finds a child of the desktop, but this causes it to return the wrong accessible if an object's parent is set to NULL for whatever reason, so check for this and return the object's root accessible in that case. --- atspi/atspi-accessible.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/atspi/atspi-accessible.c b/atspi/atspi-accessible.c index 05d2e16..86f47d8 100644 --- a/atspi/atspi-accessible.c +++ b/atspi/atspi-accessible.c @@ -719,6 +719,16 @@ atspi_accessible_get_application (AtspiAccessible *obj, GError **error) for (;;) { parent = atspi_accessible_get_parent (obj, NULL); + if (!parent && + atspi_accessible_get_role (obj, NULL) != ATSPI_ROLE_APPLICATION) + { + AtspiAccessible *root = g_object_ref (obj->parent.app->root); + if (root) + { + g_object_unref (obj); + return root; + } + } if (!parent || parent == obj || atspi_accessible_get_role (parent, NULL) == ATSPI_ROLE_DESKTOP_FRAME) return obj; -- 2.7.4